Skip to content

enable misc test cases on XPU #38852

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

Merged
merged 7 commits into from
Jun 18, 2025
Merged

enable misc test cases on XPU #38852

merged 7 commits into from
Jun 18, 2025

Conversation

yao-matrix
Copy link
Contributor

@ydshieh, pls help review, thx very much.

Signed-off-by: YAO Matrix <matrix.yao@intel.com>
Signed-off-by: YAO Matrix <matrix.yao@intel.com>
@@ -3940,7 +3941,7 @@ def test_torchdynamo_memory(self):
from torch import _dynamo as torchdynamo

class CustomTrainer(Trainer):
def compute_loss(self, model, inputs, return_outputs=False):
def compute_loss(self, model, inputs, num_items_in_batch=None, return_outputs=False):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix the similar issue as #36331

Signed-off-by: YAO Matrix <matrix.yao@intel.com>
Signed-off-by: YAO Matrix <matrix.yao@intel.com>
@@ -623,7 +623,7 @@ def test_simple_generate(self):
(
"xpu",
3,
): "<|begin_of_text|>Hey how are you doing on this lovely evening? I hope you are all doing well. Today I",
): "<|begin_of_text|>Hey how are you doing on this lovely evening? I hope you are all doing well. I am",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tweak ground truth on stock PyTorch

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you don't mind, could you change

                (
                    "cuda",
                    8,
                )

to

                ("cuda", 8)

etc.

no big deal though 🙏

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, could you share what is stock PyTorch? You probably mentioned once but I can't remember.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, sorry for confusing on vocabulary. stock PyTorch in our vocabulary means "PyTorch released by Meta w/o any extensions or modification", it's what users can get by pip install torch --index-url xxx

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you don't mind, could you change

                (
                    "cuda",
                    8,
                )

to

                ("cuda", 8)

etc.

no big deal though 🙏

done, thx.

Signed-off-by: YAO Matrix <matrix.yao@intel.com>
Copy link
Collaborator

@ydshieh ydshieh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just a 2 or 3 nit comments or questions

Thank you

@@ -623,7 +623,7 @@ def test_simple_generate(self):
(
"xpu",
3,
): "<|begin_of_text|>Hey how are you doing on this lovely evening? I hope you are all doing well. Today I",
): "<|begin_of_text|>Hey how are you doing on this lovely evening? I hope you are all doing well. I am",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you don't mind, could you change

                (
                    "cuda",
                    8,
                )

to

                ("cuda", 8)

etc.

no big deal though 🙏

@@ -623,7 +623,7 @@ def test_simple_generate(self):
(
"xpu",
3,
): "<|begin_of_text|>Hey how are you doing on this lovely evening? I hope you are all doing well. Today I",
): "<|begin_of_text|>Hey how are you doing on this lovely evening? I hope you are all doing well. I am",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, could you share what is stock PyTorch? You probably mentioned once but I can't remember.

@@ -1623,9 +1623,10 @@ def is_any_loss_nan_or_inf(log_history):
self.assertFalse(is_any_loss_nan_or_inf(log_history_filter))

def test_train_and_eval_dataloaders(self):
if torch_device in ["cuda", "xpu"]:
if torch_device in ["cuda"]:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am ok, but since you added that before, it was a mistake back then?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, it was a mistake by me. In that time I just tested in a single card, so may missed. In my recent test in multi-card env, i find it fail and debug to the DP issue... That's why i put a comment in else statement, to remind me and other xpu guys to avoid later mistakes in case we forgot the history, :)

Signed-off-by: YAO Matrix <matrix.yao@intel.com>
}
)
# fmt: on
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it could be a simple # fmt: skip after the ending ). For the next time :-) though, if you find it's easier to add.

@ydshieh ydshieh merged commit 3526e25 into huggingface:main Jun 18, 2025
18 checks passed
@yao-matrix yao-matrix deleted the ut-xpu branch June 18, 2025 23:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants