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

[Question] Safetensors seem to block the main thread -- but torch.save does not? #541

Open
vedantroy opened this issue Nov 15, 2024 · 0 comments

Comments

@vedantroy
Copy link

I have the following code in my training loop:

                if rank == 0:
                    t = Thread(
                        target=save_file,
                        args=(model_sd, f"{cfg.model_dir}/model_{step + 1}.safetensors"),
                        daemon=True
                    )
                    t.start()

Which saves the checkpoint to disk using safetensors. However, I notice that this blocks the training loop, even though the thread should be running in the background.

When I switch the code to use torch.save, there's no issue. What should I do?

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

No branches or pull requests

1 participant