-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refine PyTorch and Polyglot modules (#89)
* Enable verbosity modifications in PyTorch module * Add new polyglot example * Add creation test * Refactor polyglot module for clarity * Fix typos and clean up comments * Refine support for TorchScript in the PyTorch module * Lint * Fix comment and file name * Remove unnecessary lines * Clean up * Lint and tidy files * Delete extraneous information * Bump version number for release * Clarify what polyglot files are * More lint * More lint
- Loading branch information
Showing
13 changed files
with
189 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
Note you may need to run `pip install pytorchfi` | ||
""" | ||
|
||
import pickle | ||
|
||
import torch | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import torch | ||
import torchvision.models as models | ||
|
||
import fickling.polyglot as polyglot | ||
|
||
model = models.mobilenet_v2() | ||
torch.save(model, "mobilenet.pth") | ||
torch.save(model, "legacy_mobilenet.pth", _use_new_zipfile_serialization=False) | ||
|
||
print("Identifying PyTorch v1.3 file:") | ||
potential_formats = polyglot.identify_pytorch_file_format("mobilenet.pth", print_results=True) | ||
|
||
print("Identifying PyTorch v0.1.10 file:") | ||
potential_formats_legacy = polyglot.identify_pytorch_file_format( | ||
"legacy_mobilenet.pth", print_results=True | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.