mirror of
https://github.com/linkedin/Liger-Kernel.git
synced 2026-10-12 02:17:47 +00:00
## Summary <!--- This is a required section; please describe the main purpose of this proposed code change. ---> 1. Fix Qwen2VL mrope tests. Transformers removed BC with Qwen2VLRotaryEmbedding which is why we need this change 2. Fix mllama tests to not use cross entropy. Using Cross Entropy causes logits mismatch which is expected as we do inplace operation in cross entropy kernel. 3. Runs make checkstyle --- there seems to be a bug in checkstyle workflow where unformatted checkstyle seems to pass tests. Changed the makefile to throw error in such cases. <!--- ## Details This is an optional section; is there anything specific that reviewers should be aware of? ---> ## Testing Done <!--- This is a required section; please describe how this change was tested. ---> <!-- Replace BLANK with your device type. For example, A100-80G-PCIe Complete the following tasks before sending your PR, and replace `[ ]` with `[x]` to indicate you have done them. --> - Hardware Type: <BLANK> - [ ] run `make test` to ensure correctness - [x] run `make checkstyle` to ensure code style - [ ] run `make test-convergence` to ensure convergence
61 lines
2.2 KiB
Makefile
61 lines
2.2 KiB
Makefile
.PHONY: test checkstyle test-convergence all serve build clean
|
|
|
|
|
|
all: checkstyle test test-convergence
|
|
|
|
# Command to run pytest for correctness tests
|
|
test:
|
|
python -m pytest --disable-warnings test/ --ignore=test/convergence
|
|
|
|
# Command to run ruff for linting and formatting code
|
|
checkstyle:
|
|
ruff check .; ruff_check_status=$$?; \
|
|
ruff format --check .; ruff_format_status=$$?; \
|
|
ruff check . --fix; \
|
|
ruff format .; \
|
|
if [ $$ruff_check_status -ne 0 ] || [ $$ruff_format_status -ne 0 ]; then \
|
|
exit 1; \
|
|
fi
|
|
|
|
# Command to run pytest for convergence tests
|
|
# We have to explicitly set HF_DATASETS_OFFLINE=1, or dataset will silently try to send metrics and timeout (80s) https://github.com/huggingface/datasets/blob/37a603679f451826cfafd8aae00738b01dcb9d58/src/datasets/load.py#L286
|
|
test-convergence:
|
|
HF_DATASETS_OFFLINE=1 python -m pytest --disable-warnings test/convergence/fp32/test_mini_models.py
|
|
HF_DATASETS_OFFLINE=1 python -m pytest --disable-warnings test/convergence/fp32/test_mini_models_multimodal.py
|
|
HF_DATASETS_OFFLINE=1 python -m pytest --disable-warnings test/convergence/fp32/test_mini_models_with_logits.py
|
|
|
|
HF_DATASETS_OFFLINE=1 python -m pytest --disable-warnings test/convergence/bf16/test_mini_models.py
|
|
HF_DATASETS_OFFLINE=1 python -m pytest --disable-warnings test/convergence/bf16/test_mini_models_multimodal.py
|
|
HF_DATASETS_OFFLINE=1 python -m pytest --disable-warnings test/convergence/bf16/test_mini_models_with_logits.py
|
|
|
|
# Command to run all benchmark scripts and update benchmarking data file
|
|
# By default this doesn't overwrite existing data for the same benchmark experiment
|
|
# run with `make run-benchmarks OVERWRITE=1` to overwrite existing benchmark data
|
|
BENCHMARK_DIR = benchmark/scripts
|
|
BENCHMARK_SCRIPTS = $(wildcard $(BENCHMARK_DIR)/benchmark_*.py)
|
|
OVERWRITE ?= 0
|
|
|
|
run-benchmarks:
|
|
@for script in $(BENCHMARK_SCRIPTS); do \
|
|
echo "Running benchmark: $$script"; \
|
|
if [ $(OVERWRITE) -eq 1 ]; then \
|
|
python $$script --overwrite; \
|
|
else \
|
|
python $$script; \
|
|
fi; \
|
|
done
|
|
|
|
# MkDocs Configuration
|
|
MKDOCS = mkdocs
|
|
CONFIG_FILE = mkdocs.yml
|
|
|
|
# MkDocs targets
|
|
serve:
|
|
$(MKDOCS) serve -f $(CONFIG_FILE)
|
|
|
|
build:
|
|
$(MKDOCS) build -f $(CONFIG_FILE)
|
|
|
|
clean:
|
|
rm -rf site/
|