Fix cached lookup filepath on windows for hub
Author: kjerk
Pull request: yes

# What does this PR do?

Add small safety mechanism to hub.py for cached lookups of model files on Windows systems.

Windows systems resolve files using `C:\\Path\\To\\File.ext` under the hood in Python, this makes the `"snapshots/([^/]+)/"` regex fail to find the commit hash. So this simply adds a safety mechanism in `extract_commit_hash` to unify the resolved file paths (replace \\ with / which works just fine in all windows apis)

## Code at issue
https://github.com/huggingface/transformers/blob/fa4eeb4fd342cdbad50d1eeacdd7d7d7bc23b080/src/transformers/utils/hub.py#L222-L226

## Found while trying
```python
CLIPTokenizer.from_pretrained(version)
```

## Before Change
![0_before](https://user-images.githubusercontent.com/2738686/192074035-c6a19b16-8f51-4ac2-9c05-b12dffcfb778.png)
### Error
![0_error](https://user-images.githubusercontent.com/2738686/192074036-c8d2238c-0292-4515-bd5a-a380ba07577f.png)

## After Change
![1_after](https://user-images.githubusercontent.com/2738686/192074041-21498c9f-9cde-4fe4-b8a7-9a6d9d341b4a.png)



<!--
Congratulations! You've made it this far! You're not quite done yet though.

Once merged, your PR is going to appear in the release notes with the title you set, so make sure it's a great title that fully reflects the extent of your awesome contribution.

Then, please replace this with a description of the change and which issue is fixed (if applicable). Please also include relevant motivation and context. List any dependencies (if any) that are required for this change.

Once you're done, someone will review your PR shortly (see the section "Who can review?" below to tag some potential reviewers). They may suggest changes to make the code even better. If no one reviewed your PR after a week has passed, don't hesitate to post a new comment @-mentioning the same persons---sometimes notifications get lost.
-->

## Before submitting
- [ ] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
- [X] Did you read the [contributor guideline](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md#start-contributing-pull-requests),
      Pull Request section?
- [ ] Was this discussed/approved via a Github issue or the [forum](https://discuss.huggingface.co/)? Please add a link
      to it if that's the case.
- [ ] Did you make sure to update the documentation with your changes? Here are the
      [documentation guidelines](https://github.com/huggingface/transformers/tree/main/docs), and
      [here are tips on formatting docstrings](https://github.com/huggingface/transformers/tree/main/docs#writing-source-documentation).
- [ ] Did you write any new necessary tests? (None pertinent found)


## Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

## Tests Run
* tests/utils/*.py

![image](https://user-images.githubusercontent.com/2738686/192075107-67f256aa-0b27-4614-be1e-18edc7813b5a.png)


<!-- Your PR will be replied to more quickly if you can figure out the right person to tag with @

 If you know how to use git blame, that is the easiest way, otherwise, here is a rough guide of **who to tag**.
 Please tag fewer than 3 people.

Models:

- albert, bert, xlm: @LysandreJik
- blenderbot, bart, marian, pegasus, encoderdecoder,  t5: @patrickvonplaten, @patil-suraj
- longformer, reformer, transfoxl, xlnet: @patrickvonplaten
- fsmt: @stas00
- funnel: @sgugger
- gpt2: @patrickvonplaten, @LysandreJik
- rag: @patrickvonplaten, @lhoestq
- tensorflow: @LysandreJik

Library:

- benchmarks: @patrickvonplaten
- deepspeed: @stas00
- ray/raytune: @richardliaw, @amogkam
- text generation: @patrickvonplaten
- tokenizers: @n1t0, @LysandreJik
- trainer: @sgugger
- pipelines: @LysandreJik

Documentation: @sgugger

HF projects:

- datasets: [different repo](https://github.com/huggingface/datasets)
- rust tokenizers: [different repo](https://github.com/huggingface/tokenizers)

Examples:

- maintained examples (not research project or legacy): @sgugger, @patil-suraj
- research_projects/bert-loses-patience: @JetRunner
- research_projects/distillation: @VictorSanh

 -->


Comments:
Re-ran black on hub.py to fix a spacing inconsistency 💀

_The documentation is not available anymore as the PR was closed or merged._

Mmm, some of the failure on the CI are due to a bug now fixed in the return of `cached_file`. Could you do a quick rebase on the main branch so I can see clearer in the failed tests?

Thanks for the rebase, we now have a clearer idea of the failing tests! This seems to break the functionality somehow (basically the commit hash is not found anymore). Maybe the regex need a small adaptation.
I'll dive into this tomorrow!

All green, thanks for iterating with us!

> All green, thanks for iterating with us!

No problem, thanks for all the suggestions :)

These cross platform fixes are always comically annoying, fix for Windows, break on *nix, of course!