Pre-Processing Cache Fails when using a Factory pattern
{'login': 'Helw150', 'id': 9847335, 'node_id': 'MDQ6VXNlcjk4NDczMzU=', 'avatar_url': 'https://avatars.githubusercontent.com/u/9847335?v=4', 'gravatar_id': '', 'url': 'https://api.github.com/users/Helw150', 'html_url': 'https://github.com/Helw150', 'followers_url': 'https://api.github.com/users/Helw150/followers', 'following_url': 'https://api.github.com/users/Helw150/following{/other_user}', 'gists_url': 'https://api.github.com/users/Helw150/gists{/gist_id}', 'starred_url': 'https://api.github.com/users/Helw150/starred{/owner}{/repo}', 'subscriptions_url': 'https://api.github.com/users/Helw150/subscriptions', 'organizations_url': 'https://api.github.com/users/Helw150/orgs', 'repos_url': 'https://api.github.com/users/Helw150/repos', 'events_url': 'https://api.github.com/users/Helw150/events{/privacy}', 'received_events_url': 'https://api.github.com/users/Helw150/received_events', 'type': 'User', 'site_admin': False}
[{'id': 1935892857, 'node_id': 'MDU6TGFiZWwxOTM1ODkyODU3', 'url': 'https://api.github.com/repos/huggingface/datasets/labels/bug', 'name': 'bug', 'color': 'd73a4a', 'default': True, 'description': "Something isn't working"}]
[]
["Ok - this is still an issue but I believe the root cause is different than I originally thought. I'm now able to get caching to work consistently with the above example as long as I fix the python hash seed `export PYTHONHASHSEED=1234`"
 'Hi! \r\n\r\nYes, our hasher should work with decorators. For instance, this dummy example:\r\n```python\r\ndef f(arg):\r\n    def f1(ex):\r\n        return {"a": ex["col1"] + arg}\r\n    return f1\r\n```\r\ngives the same hash across different Python sessions (`datasets.fingerprint.Hasher.hash(f("string1")` returns `"408c9059f89dbd6c"` on my machine).\r\n\r\nCould you please make the example self-contained? This way, we can reproduce the bug. Additionally, you can try to find the problematic object yourself by testing their hash with `datasets.fingerprint.Hasher.hash(obj)`\r\n\r\nThis could be related to https://github.com/huggingface/datasets/issues/3638.'
 '#3638 was indeed my issue. Thanks!']
## Describe the bug
If you utilize a pre-processing function which is created using a factory pattern, the function hash changes on each run (even if the function is identical) and therefore the data will be reproduced each time.

## Steps to reproduce the bug
```python
    def preprocess_function_factory(augmentation=None):
        def preprocess_function(examples):
            # Tokenize the texts
            if augmentation:
                conversions1 = [
                    augmentation(example)
                    for example in examples[sentence1_key]
                ]
                if sentence2_key is None:
                    args = (conversions1,)
                else:
                    conversions2 = [
                        augmentation(example)
                        for example in examples[sentence2_key]
                    ]
                    args = (conversions1, conversions2)
            else:
                args = (
                    (examples[sentence1_key],)
                    if sentence2_key is None
                    else (examples[sentence1_key], examples[sentence2_key])
                )
            result = tokenizer(
                *args, padding=padding, max_length=max_seq_length, truncation=True
            )

            # Map labels to IDs (not necessary for GLUE tasks)
            if label_to_id is not None and "label" in examples:
                result["label"] = [
                    (label_to_id[l] if l != -1 else -1) for l in examples["label"]
                ]
            return result

        return preprocess_function

capitalize = lambda x: x.capitalize()
preprocess_function = preprocess_function_factory(augmentation=capitalize)
print(hash(preprocess_function)) # This will change on each run
raw_datasets = raw_datasets.map(
        preprocess_function,
        batched=True,
        load_from_cache_file=True,
        desc="Running transformation and tokenizer on dataset",
)
```

## Expected results
Running the code twice will cause the cache to be re-used.

## Actual results
Running the code twice causes the whole dataset to be re-processed

{'url': 'https://api.github.com/repos/huggingface/datasets/issues/3808/reactions', 'total_count': 0, '+1': 0, '-1': 0, 'laugh': 0, 'hooray': 0, 'confused': 0, 'heart': 0, 'rocket': 0, 'eyes': 0}