Use extended path on Windows when downloading to local dir (#2378)
* Use extended path on Windows when downloading to local dir
Change the path of the local dir to an extended path by prepending
"\\?\" to the absolute path, when the absolute path is longer
than 255 characters on Windows.
Also fixed a small typo.
* Use extended path on Windows when downloading to local dir
Change the path of the local dir to an extended path by prepending
"\\?\" to the absolute path, when the absolute path is longer
than 255 characters on Windows.
Also fixed a small typo.
* Move path handling to `get_local_download_paths()` for robustness
On Windows we check the length of `lock_path` and if it is longer than
255 characters we prepend the `\\?\` prefix to all paths if it does not
already exist.
We only need to check the length of `lock_path` because it is guaranteed
to be the longest path.
* `safetensors[torch]` (#2371)
* Fix token=False not respected in file download (#2386)
* Fix token=False not respected in file download
* lint
* Handle shared layers in `save_torch_state_dict` + add `save_torch_model` (#2373)
* Handle shared layers in save_torch_state_dict + save_torch_model + some helpers
* fix pytest rerun
* more reruns
* Support `expand` parameter in `xxx_info` and `list_xxxs` (model/dataset/Space) (#2333)
* First draft to support `expand` parameter for models
* add expand support for dataset
* add expand support for Space
* Use extended path on Windows when downloading to local dir
Change the path of the local dir to an extended path by prepending
"\\?\" to the absolute path, when the absolute path is longer
than 255 characters on Windows.
Also fixed a small typo.
* Move path handling to `get_local_download_paths()` for robustness
On Windows we check the length of `lock_path` and if it is longer than
255 characters we prepend the `\\?\` prefix to all paths if it does not
already exist.
We only need to check the length of `lock_path` because it is guaranteed
to be the longest path.
* Use extended path on Windows when downloading to local dir
Change the path of the local dir to an extended path by prepending
"\\?\" to the absolute path, when the absolute path is longer
than 255 characters on Windows.
Also fixed a small typo.
* Removed old path handling
* Reorder path check; add tests
* Skip test if opn Windows
The test now shows up a `skipped` if executed on a non-Windows machine
Co-authored-by: Lucain <lucainp@gmail.com>
* Fix indentation for test_local_folder.py
* Fix code style
---------
Co-authored-by: Lucain <lucain@huggingface.co>
Co-authored-by: Quentin Gallouédec <45557362+qgallouedec@users.noreply.github.com>
Co-authored-by: Lucain <lucainp@gmail.com>