Transform fingerprint collisions due to setting fixed random seed
COLLABORATOR
I've opened a PR with a fix.
2024-01-19T18:37:14Z
https://github.com/huggingface/datasets/issues/6604#issuecomment-1900916552
https://api.github.com/repos/huggingface/datasets/issues/6604
IC_kwDODunzps5xTa9I
https://api.github.com/repos/huggingface/datasets/issues/comments/1900916552/reactions
2024-01-19T18:37:14Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1900916552
https://avatars.githubusercontent.com/u/47462742?v=4
https://api.github.com/users/mariosasko/events{/privacy}
https://api.github.com/users/mariosasko/followers
https://api.github.com/users/mariosasko/following{/other_user}
https://api.github.com/users/mariosasko/gists{/gist_id}
https://github.com/mariosasko
mariosasko
MDQ6VXNlcjQ3NDYyNzQy
https://api.github.com/users/mariosasko/orgs
https://api.github.com/users/mariosasko/received_events
https://api.github.com/users/mariosasko/repos
https://api.github.com/users/mariosasko/starred{/owner}{/repo}
https://api.github.com/users/mariosasko/subscriptions
User
https://api.github.com/users/mariosasko
public
NONE
I don't think the PR fixes the root cause, since it still relies on the `random` library which will often have its seed fixed. I think the builtin `uuid.uuid4()` is a better choice: https://docs.python.org/3/library/uuid.html
2024-01-21T22:35:49Z
https://github.com/huggingface/datasets/issues/6604#issuecomment-1902788733
https://api.github.com/repos/huggingface/datasets/issues/6604
IC_kwDODunzps5xakB9
https://api.github.com/repos/huggingface/datasets/issues/comments/1902788733/reactions
2024-01-21T22:35:49Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1902788733
https://avatars.githubusercontent.com/u/6687910?v=4
https://api.github.com/users/normster/events{/privacy}
https://api.github.com/users/normster/followers
https://api.github.com/users/normster/following{/other_user}
https://api.github.com/users/normster/gists{/gist_id}
https://github.com/normster
normster
MDQ6VXNlcjY2ODc5MTA=
https://api.github.com/users/normster/orgs
https://api.github.com/users/normster/received_events
https://api.github.com/users/normster/repos
https://api.github.com/users/normster/starred{/owner}{/repo}
https://api.github.com/users/normster/subscriptions
User
https://api.github.com/users/normster
public
### Describe the bug

The transform fingerprinting logic relies on the `random` library for random bits when the function is not hashable (e.g. bound methods as used in `trl`: https://github.com/huggingface/trl/blob/main/trl/trainer/dpo_trainer.py#L356). This causes collisions when the training code sets a fixed random seed, which is common practice: https://github.com/huggingface/alignment-handbook/blob/main/recipes/zephyr-7b-beta/sft/config_full.yaml#L45.

This results in fingerprint collisions which leads to silently loading incorrect cache files corresponding to completely different datasets.

### Steps to reproduce the bug

n/a

### Expected behavior

Use `uuid` v4 instead of `random.getrandbits()`

### Environment info

`datasets` main branch