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

[tests] use torch_device instead of auto for model testing #29531

Merged
merged 5 commits into from
Mar 8, 2024
Merged
Changes from 2 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
5 changes: 4 additions & 1 deletion tests/generation/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1073,6 +1073,9 @@ def test_beam_search_generate_dict_outputs_use_cache(self):
@require_torch_multi_accelerator
def test_model_parallel_beam_search(self):
for model_class in self.all_generative_model_classes:
if torch_device == "xpu":
faaany marked this conversation as resolved.
Show resolved Hide resolved
return unittest.skip("device_map='auto' does not work with XPU devices")

if model_class._no_split_modules is None:
continue

Expand All @@ -1081,7 +1084,7 @@ def test_model_parallel_beam_search(self):
model = model_class(config).eval()
with tempfile.TemporaryDirectory() as tmp_dir:
model.cpu().save_pretrained(tmp_dir)
new_model = model_class.from_pretrained(tmp_dir, device_map=torch_device)
new_model = model_class.from_pretrained(tmp_dir, device_map="auto")

new_model.generate(
input_ids,
Expand Down