Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move clearml tests to appropriate place to unblock GHA #2234

Merged
merged 9 commits into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions .github/workflows/test-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,14 @@ jobs:
- name: "🔬 Running onnx tests"
run: make test TARGETS=onnx
pytorch-tests:
runs-on: ubuntu-22.04
runs-on: aws-avx2-64G
env:
SPARSEZOO_TEST_MODE: "true"
CLEARML_WEB_HOST: ${{ secrets.CLEARML_WEB_HOST }}
CLEARML_API_HOST: ${{ secrets.CLEARML_API_HOST }}
CLEARML_API_ACCESS_KEY: ${{ secrets.CLEARML_API_ACCESS_KEY }}
CLEARML_FILES_HOST: ${{ secrets.CLEARML_FILES_HOST }}
CLEARML_API_SECRET_KEY: ${{ secrets.CLEARML_API_SECRET_KEY }}
needs: test-setup
if: ${{needs.test-setup.outputs.pytorch == 1}}
steps:
Expand All @@ -164,9 +169,14 @@ jobs:
- name: "🔬 Running pytorch tests"
run: make test TARGETS=pytorch
compat-pytorch-1_9-pytorch-tests:
runs-on: ubuntu-22.04
runs-on: aws-avx2-64G
env:
SPARSEZOO_TEST_MODE: "true"
CLEARML_WEB_HOST: ${{ secrets.CLEARML_WEB_HOST }}
CLEARML_API_HOST: ${{ secrets.CLEARML_API_HOST }}
CLEARML_API_ACCESS_KEY: ${{ secrets.CLEARML_API_ACCESS_KEY }}
CLEARML_FILES_HOST: ${{ secrets.CLEARML_FILES_HOST }}
CLEARML_API_SECRET_KEY: ${{ secrets.CLEARML_API_SECRET_KEY }}
needs: test-setup
if: ${{needs.test-setup.outputs.pytorch == 1}}
steps:
Expand Down Expand Up @@ -212,9 +222,14 @@ jobs:
- name: "🔬 Running onnx tests"
run: make test TARGETS=onnx
transformers-tests:
runs-on: ubuntu-22.04
runs-on: aws-avx2-64G
env:
SPARSEZOO_TEST_MODE: "true"
CLEARML_WEB_HOST: ${{ secrets.CLEARML_WEB_HOST }}
CLEARML_API_HOST: ${{ secrets.CLEARML_API_HOST }}
CLEARML_API_ACCESS_KEY: ${{ secrets.CLEARML_API_ACCESS_KEY }}
CLEARML_FILES_HOST: ${{ secrets.CLEARML_FILES_HOST }}
CLEARML_API_SECRET_KEY: ${{ secrets.CLEARML_API_SECRET_KEY }}
needs: test-setup
if: ${{needs.test-setup.outputs.transformers == 1}}
steps:
Expand Down
2 changes: 1 addition & 1 deletion tests/sparseml/transformers/finetune/test_finetune.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def test_oneshot_then_finetune(tmp_path: Path):
)


def test_finetune_wout_recipe(tmp_path: Path):
def test_finetune_without_recipe(tmp_path: Path):
recipe_str = None
model = "Xenova/llama2.c-stories15M"
device = "cuda:0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def test_apply_recipe_structure():
model = AutoModelForCausalLM.from_pretrained(model_path)
assert not qat_active(model)

recipe_with_quant = "tests/sparseml/transformers/obcq/test_tiny.yaml"
recipe_with_quant = "tests/sparseml/transformers/obcq/quant_and_sparse.yaml"
apply_recipe_structure_to_model(model, recipe_with_quant, model_path)

assert qat_active(model)
Original file line number Diff line number Diff line change
Expand Up @@ -14,46 +14,29 @@

from pathlib import Path

from clearml import Task
from sparseml.transformers import apply
from sparseml.utils import is_package_available


is_torch_available = is_package_available("torch")
if is_torch_available:
import torch
import torch

torch_err = None
else:
torch = object
torch_err = ModuleNotFoundError(
"`torch` is not installed, use `pip install torch` to log to Weights and Biases"
)
from clearml import Task
from sparseml.transformers import train


def test_oneshot_and_finetune(tmp_path: Path):
recipe_str = "tests/sparseml/transformers/finetune/test_alternate_recipe.yaml"
def test_finetune_wout_recipe(tmp_path: Path):
recipe_str = None
model = "Xenova/llama2.c-stories15M"
device = "cuda:0"
if is_torch_available and not torch.cuda.is_available():
if not torch.cuda.is_available():
device = "cpu"
dataset = "wikitext"
dataset_config_name = "wikitext-2-raw-v1"
concatenate_data = True
run_stages = True
dataset = "open_platypus"
concatenate_data = False
output_dir = tmp_path
max_steps = 50
splits = {"train": "train[:50%]", "calibration": "train[50%:60%]"}
splits = "train"

# clearML will automatically log default capturing entries without
# explicitly calling logger. Logs accessible in https://app.clear.ml/
Task.init(project_name="test", task_name="test_oneshot_and_finetune")

apply(
train(
model=model,
dataset=dataset,
dataset_config_name=dataset_config_name,
run_stages=run_stages,
output_dir=output_dir,
recipe=recipe_str,
max_steps=max_steps,
Expand Down
Loading