We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 00c6ca4 commit 70724bdCopy full SHA for 70724bd
torch/_inductor/codecache.py
@@ -565,9 +565,13 @@ def get_code_hash(roots):
565
module = spec.origin
566
assert module is not None
567
with open(module, "rb") as f:
568
- contents[module] = f.read()
569
-
570
- return hashlib.sha256(pickle.dumps(contents)).digest()
+ contents[spec.name] = f.read()
+ hasher = hashlib.sha256()
+ # Iterate over dict in sorted order since iter_modules may not be deterministic
571
+ for name, value in sorted(contents.items()):
572
+ hasher.update(name.encode("utf-8"))
573
+ hasher.update(value)
574
+ return hasher.digest()
575
576
577
@functools.lru_cache(None)
0 commit comments