-
Notifications
You must be signed in to change notification settings - Fork 31.7k
enable trainer test cases on xpu #38138
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
Conversation
Signed-off-by: Matrix Yao <[email protected]>
Signed-off-by: Matrix Yao <[email protected]>
|
Hi 👋, thank you for opening this pull request! The pull request is converted to draft by default. The CI will be paused while the PR is in draft mode. When it is ready for review, please click the |
|
@ydshieh @IlyasMoutawwakil , pls help review, thx. |
| """ | ||
| env = os.environ.copy() | ||
| paths = [self.src_dir_str] | ||
| paths = [self.repo_root_dir_str, self.src_dir_str] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is an implicit issue here.
- In the env where
PYTHONPATHis empty, the line 2049 code joinsrcandtesttoPYTHONPATHwith an extra ":"(since paths has a "" string because of the codepaths.append(env.get("PYTHONPATH", ""))), so the finalPYTHONPATHwill be like/transformers/src:/transformers/tests:with a trailing:, which implies the current folder which is/transformers. - But when it comes the an env with an non-empty
PYTHONPATH, theenv["PYTHONPATH"] = ":".join(paths)will generate/transformers/src:/transformers/tests:A:Bpath without training:, which means current folder not included in thePYTHONPATH
So, in situation 2), test cases like tests/trainer/test_trainer_distributed_loss.py will fail, since while torchrun, the from tests.trainer.test_trainer import StoreLossCallback will not found, since there is only /transformers/src:/transformers/tests in PYTHONPATH, but the import statement actually needs /transformers/
what i do is making it explicit, but this is just for the cases i can see, i don't know other background.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SGTM. But just to understand better,
when it comes the an env with an non-empty PYTHONPATH
So in your environment, this is the case? Do you set it somehow?
In our report, I see
tests/trainer/test_trainer_distributed_loss.py::TestTrainerDistributedLoss::test_trainer
(line 675) AssertionError: 0.8057947486768737 not less than 0.1
So it seems there is no import issue in our runner env.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ydshieh yes, in my CUDA env, there is no such issue either, since PYTHONPATH is empty. But in my XPU env, since Intel oneAPI will preset some paths into PYTHONPATH, and it doesn't work. That's the background i looked into that issue and found it,:)
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
No description provided.