Skip to content

Update pytorch-model.md with a new troubleshooting help #3081

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 3 commits into from
Apr 25, 2025

Conversation

antimora
Copy link
Collaborator

Pull Request Template

Checklist

  • Confirmed that run-checks all script has been executed.
  • Made sure the book is up to date with changes in this PR.

Changes

Update pytorch import book section on troubleshooting

Testing

Rendered the book

@antimora antimora requested a review from laggui April 25, 2025 17:27
Copy link
Member

@laggui laggui left a comment

Choose a reason for hiding this comment

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

The new section is superfluous.

The first section after the intro is already How to export a PyTorch model

and the example clearly shows the state_dict() being saved.

if __name__ == "__main__":
    torch.manual_seed(42)  # To make it reproducible
    model = Net().to(torch.device("cpu"))
    model_weights = model.state_dict()
    torch.save(model_weights, "conv2d.pt")

Instead of adding a whole new section even further down, I would simply add a sentence in the first section to highlight that only the state dict should be saved.

@antimora antimora requested a review from laggui April 25, 2025 18:09
Copy link
Member

@laggui laggui left a comment

Choose a reason for hiding this comment

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

Makes more sense now! Steps flow naturally.

Two minor comments, then will be good to go!

@antimora antimora requested a review from laggui April 25, 2025 18:25
@laggui laggui merged commit 4a28812 into tracel-ai:main Apr 25, 2025
@antimora antimora deleted the pytorch-import-troubleshoot-doc branch April 26, 2025 21:19
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