-
-
Notifications
You must be signed in to change notification settings - Fork 50
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
Fix pytorch-cpu/gpu build only for single python version #282
Merged
hmaarrfk
merged 4 commits into
conda-forge:main
from
jeongseok-meta:fix_pytorch_cpu_strings
Nov 5, 2024
+44
−4
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
diff --git a/torch/serialization.py b/torch/serialization.py | ||
index d936d31d6f5..d937680c031 100644 | ||
--- a/torch/serialization.py | ||
+++ b/torch/serialization.py | ||
@@ -1005,8 +1005,12 @@ def _legacy_save(obj, f, pickle_module, pickle_protocol) -> None: | ||
pickle_module.dump(MAGIC_NUMBER, f, protocol=pickle_protocol) | ||
pickle_module.dump(PROTOCOL_VERSION, f, protocol=pickle_protocol) | ||
pickle_module.dump(sys_info, f, protocol=pickle_protocol) | ||
- pickler = pickle_module.Pickler(f, protocol=pickle_protocol) | ||
- pickler.persistent_id = persistent_id | ||
+ | ||
+ class PyTorchLegacyPickler(pickle_module.Pickler): | ||
+ def persistent_id(self, obj): | ||
+ return persistent_id(obj) | ||
+ | ||
+ pickler = PyTorchLegacyPickler(f, protocol=pickle_protocol) | ||
pickler.dump(obj) | ||
|
||
serialized_storage_keys = sorted(serialized_storages.keys()) | ||
@@ -1083,8 +1087,12 @@ def _save( | ||
|
||
# Write the pickle data for `obj` | ||
data_buf = io.BytesIO() | ||
- pickler = pickle_module.Pickler(data_buf, protocol=pickle_protocol) | ||
- pickler.persistent_id = persistent_id | ||
+ | ||
+ class PyTorchPickler(pickle_module.Pickler): # type: ignore[name-defined] | ||
+ def persistent_id(self, obj): | ||
+ return persistent_id(obj) | ||
+ | ||
+ pickler = PyTorchPickler(data_buf, protocol=pickle_protocol) | ||
pickler.dump(obj) | ||
data_value = data_buf.getvalue() | ||
zip_file.write_record("data.pkl", data_value, len(data_value)) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I think you might want to remove this line, otherwise you'll fix to a python version for non-megabuild variants?
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.
The non megabuillds should have multiple packags created. Is that not the case?
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.
ah, ok. I'm sure you're right, I need to check more carefully I think.
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.
Still getting familiar with your recipe.
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.
The megabuilds were created since before the large runner from quantsigh hour builds, we used to HAVE to build locally. And it would effectively save me a 12 hours of rebuilding libtorch 4 times.
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.
Thanks. I guess "megabuild" = 1 x libtorch and 5 x python bindings/code, as opposed to 5 x normal builds (libtorch + bindings + python code)?