Skip to content
Open
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
2 changes: 1 addition & 1 deletion tests/data/processor/test_feedback.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
}


@pytest.mark.runs_on(["cpu", "mps"])
@pytest.mark.runs_on(["cpu", "mps", "xpu"])
@pytest.mark.parametrize("num_samples", [16])
def test_feedback_data(num_samples: int):
train_dataset = load_dataset_module(**TRAIN_ARGS)["train_dataset"]
Expand Down
2 changes: 1 addition & 1 deletion tests/data/processor/test_pairwise.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def _convert_sharegpt_to_openai(messages: list[dict[str, str]]) -> list[dict[str
return new_messages


@pytest.mark.runs_on(["cpu", "mps"])
@pytest.mark.runs_on(["cpu", "mps", "xpu"])
@pytest.mark.parametrize("num_samples", [16])
def test_pairwise_data(num_samples: int):
train_dataset = load_dataset_module(**TRAIN_ARGS)["train_dataset"]
Expand Down
2 changes: 1 addition & 1 deletion tests/data/processor/test_processor_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from llamafactory.data.processor.processor_utils import infer_seqlen


@pytest.mark.runs_on(["cpu", "mps"])
@pytest.mark.runs_on(["cpu", "mps", "xpu"])
@pytest.mark.parametrize(
"test_input,test_output",
[
Expand Down
8 changes: 4 additions & 4 deletions tests/data/processor/test_supervised.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
}


@pytest.mark.runs_on(["cpu", "mps"])
@pytest.mark.runs_on(["cpu", "mps", "xpu"])
@pytest.mark.parametrize("num_samples", [16])
def test_supervised_single_turn(num_samples: int):
train_dataset = load_dataset_module(dataset_dir="ONLINE", dataset=TINY_DATA, **TRAIN_ARGS)["train_dataset"]
Expand Down Expand Up @@ -72,7 +72,7 @@ def test_supervised_single_turn(num_samples: int):
assert train_dataset["labels"][index] == ref_label_ids


@pytest.mark.runs_on(["cpu", "mps"])
@pytest.mark.runs_on(["cpu", "mps", "xpu"])
@pytest.mark.parametrize("num_samples", [8])
def test_supervised_multi_turn(num_samples: int):
train_dataset = load_dataset_module(dataset_dir="REMOTE:" + DEMO_DATA, dataset="system_chat", **TRAIN_ARGS)[
Expand All @@ -90,7 +90,7 @@ def test_supervised_multi_turn(num_samples: int):
assert train_dataset["input_ids"][index] == ref_input_ids


@pytest.mark.runs_on(["cpu", "mps"])
@pytest.mark.runs_on(["cpu", "mps", "xpu"])
@pytest.mark.parametrize("num_samples", [4])
def test_supervised_train_on_prompt(num_samples: int):
train_dataset = load_dataset_module(
Expand All @@ -108,7 +108,7 @@ def test_supervised_train_on_prompt(num_samples: int):
assert train_dataset["labels"][index] == ref_input_ids


@pytest.mark.runs_on(["cpu", "mps"])
@pytest.mark.runs_on(["cpu", "mps", "xpu"])
@pytest.mark.parametrize("num_samples", [4])
def test_supervised_mask_history(num_samples: int):
train_dataset = load_dataset_module(
Expand Down
2 changes: 1 addition & 1 deletion tests/data/processor/test_unsupervised.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
}


@pytest.mark.runs_on(["cpu", "mps"])
@pytest.mark.runs_on(["cpu", "mps", "xpu"])
@pytest.mark.parametrize("num_samples", [16])
def test_unsupervised_data(num_samples: int):
train_dataset = load_dataset_module(**TRAIN_ARGS)["train_dataset"]
Expand Down
8 changes: 4 additions & 4 deletions tests/data/test_collator.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
TINY_LLAMA3 = os.getenv("TINY_LLAMA3", "llamafactory/tiny-random-Llama-3")


@pytest.mark.runs_on(["cpu", "mps"])
@pytest.mark.runs_on(["cpu", "mps", "xpu"])
def test_base_collator():
model_args, data_args, *_ = get_infer_args({"model_name_or_path": TINY_LLAMA3, "template": "default"})
tokenizer_module = load_tokenizer(model_args)
Expand Down Expand Up @@ -76,7 +76,7 @@ def test_base_collator():
assert batch_input[k].eq(torch.tensor(expected_input[k])).all()


@pytest.mark.runs_on(["cpu", "mps"])
@pytest.mark.runs_on(["cpu", "mps", "xpu"])
def test_multimodal_collator():
model_args, data_args, *_ = get_infer_args(
{"model_name_or_path": "Qwen/Qwen2-VL-2B-Instruct", "template": "qwen2_vl"}
Expand Down Expand Up @@ -270,7 +270,7 @@ def _get_expected_position_ids(
return torch.cat(all_position_ids, dim=-1)


@pytest.mark.runs_on(["cpu", "mps"])
@pytest.mark.runs_on(["cpu", "mps", "xpu"])
def test_multimodal_collator_with_packing():
model_args, data_args, *_ = get_infer_args(
{"model_name_or_path": "Qwen/Qwen2-VL-2B-Instruct", "template": "qwen2_vl"}
Expand Down Expand Up @@ -322,7 +322,7 @@ def test_multimodal_collator_with_packing():
assert batch_input["position_ids"][1:, :, :valid_len].eq(expected_position_ids).all()


@pytest.mark.runs_on(["cpu"])
@pytest.mark.runs_on(["cpu", "xpu"])
def test_4d_attention_mask():
o = 0.0
x = torch.finfo(torch.float16).min
Expand Down
4 changes: 2 additions & 2 deletions tests/data/test_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from llamafactory.hparams import DataArguments


@pytest.mark.runs_on(["cpu", "mps"])
@pytest.mark.runs_on(["cpu", "mps", "xpu"])
def test_alpaca_converter():
dataset_attr = DatasetAttr("hf_hub", "llamafactory/tiny-supervised-dataset")
data_args = DataArguments()
Expand All @@ -41,7 +41,7 @@ def test_alpaca_converter():
}


@pytest.mark.runs_on(["cpu", "mps"])
@pytest.mark.runs_on(["cpu", "mps", "xpu"])
def test_sharegpt_converter():
dataset_attr = DatasetAttr("hf_hub", "llamafactory/tiny-supervised-dataset")
data_args = DataArguments()
Expand Down
Loading