Files
Liger-Kernel/dev/modal/tests.py
T
Byron Hsu 3a0cbdff4b Fix liger orpo trainer import error (#459)
## Summary
<!--- This is a required section; please describe the main purpose of
this proposed code change. --->

<!---
## Details
This is an optional section; is there anything specific that reviewers
should be aware of?
--->

To fix https://github.com/linkedin/Liger-Kernel/issues/458

1. Move orpo trainer to trainer/
2. Remove trl from `[dev]` now so the test represents the actual user
environment.
3. Disable Qwen VL test for transformers>=4.47.0 for now and create
issue https://github.com/linkedin/Liger-Kernel/issues/461
## 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
- [ ] run `make checkstyle` to ensure code style
- [ ] run `make test-convergence` to ensure convergence
2024-12-10 01:29:20 -08:00

31 lines
955 B
Python

import os
from pathlib import Path
import modal
ROOT_PATH = Path(__file__).parent.parent.parent
REMOTE_ROOT_PATH = "/root/liger-kernel"
# REBUILD_IMAGE is an environment variable that is set to "true" in the nightly build
REBUILD_IMAGE = os.getenv("REBUILD_IMAGE") is not None
image = modal.Image.debian_slim().pip_install_from_pyproject(
ROOT_PATH / "pyproject.toml",
optional_dependencies=["dev"],
force_build=REBUILD_IMAGE,
)
app = modal.App("liger_tests", image=image)
# mount: add local files to the remote container
repo = modal.Mount.from_local_dir(ROOT_PATH, remote_path=REMOTE_ROOT_PATH)
@app.function(gpu="A10G", mounts=[repo], timeout=60 * 15)
def liger_tests():
import subprocess
subprocess.run(["pip", "install", "-e", "."], check=True, cwd=REMOTE_ROOT_PATH)
subprocess.run(["make", "test"], check=True, cwd=REMOTE_ROOT_PATH)
subprocess.run(["make", "test-convergence"], check=True, cwd=REMOTE_ROOT_PATH)