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

[CustomDevice] fix loading rng state on custom devices #7894

Merged
merged 1 commit into from
Jan 26, 2024
Merged
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
4 changes: 3 additions & 1 deletion paddlenlp/trainer/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1548,7 +1548,9 @@
if not len(checkpoint_rng_state["cuda"]) == core.get_custom_device_count(device):
raise ValueError("Length of custom device state list shoule be equal to the custom device count")
for i in range(core.get_custom_device_count(device)):
core.default_custom_device_generator(i).manual_seed(checkpoint_rng_state["cuda"][i])
core.default_custom_device_generator(paddle.CustomPlace(device, i)).manual_seed(

Check warning on line 1551 in paddlenlp/trainer/trainer.py

View check run for this annotation

Codecov / codecov/patch

paddlenlp/trainer/trainer.py#L1551

Added line #L1551 was not covered by tests
checkpoint_rng_state["cuda"][i]
)

if self.args.use_hybrid_parallel:
if "hybrid_parallel_rng_state_tracker" in checkpoint_rng_state:
Expand Down