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

Hashing of equal DictConfig objects differ #1190

Open
4 tasks done
esskov opened this issue Aug 16, 2024 · 0 comments
Open
4 tasks done

Hashing of equal DictConfig objects differ #1190

esskov opened this issue Aug 16, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@esskov
Copy link

esskov commented Aug 16, 2024

Describe the bug
It seems there is an issue related to how much metadata or context is passed when hashing a DictConfig object. As a consequence, hashes of two DictConfig objects differ, in cases where the objects are in fact equal. We have observed this in cases where the 2 objects are "sub configs" of the parent DictConfig object.

To Reproduce

import joblib
import hashlib
import pickle
from omegaconf import OmegaConf, DictConfig

d = OmegaConf.create({'a' : {'c': 1}, 'b' : {'c': 1}})

assert joblib.hash(DictConfig(d.a)) == joblib.hash(DictConfig(d.b)) # Passes
assert joblib.hash(d.a) == joblib.hash(d.b) # Fails

assert hashlib.md5(pickle.dumps(DictConfig(d.a))).hexdigest() == hashlib.md5(pickle.dumps(DictConfig(d.b))).hexdigest() # Passes
assert hashlib.md5(pickle.dumps(d.a)).hexdigest() == hashlib.md5(pickle.dumps(d.b)).hexdigest() # Fails

Expected behavior
I would expect all 4 assert statements to pass. It is unexpected that hash(d.a) != hash(d.b) when d.a == d.b.

Additional context

  • OmegaConf version: 2.3.0
  • Python version: 3.9.18
  • Operating system: Windows 10
  • Please provide a minimal repro
@esskov esskov added the bug Something isn't working label Aug 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant