You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Support volumes at repo creation and duplication (#4035)
* Support volumes at repo creation and duplication
Add `space_volumes` parameter to `create_repo` and `duplicate_repo` in
`HfApi`, and wire it up as `--volume`/`-v` in the CLI `repos create` and
`repos duplicate` commands. Shared volume parsing logic moved from
`jobs.py` to `_cli_utils.py` to avoid duplication.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix tests
* update deprecation warnings
* unrelevant json key
* revert manually added bug
* define a space_args list of tuples
* some parse_volumes optim
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: docs/source/en/guides/manage-spaces.md
+29-5Lines changed: 29 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -201,16 +201,27 @@ Upgraded hardware will be automatically assigned to your Space once it's built.
201
201
202
202
**6. Mount volumes in your Space**
203
203
204
-
You can mount Hub resources (models, datasets, or storage buckets) as volumes in your Space's container. This gives your Space direct filesystem access to these resources without having to download them in your code.
204
+
You can mount Hub resources (models, datasets, or storage buckets) as volumes in your Space's container. This gives your Space direct filesystem access to these resources without having to download them in your code. Volumes can be set directly when creating or duplicating a Space:
*`--secrets-file TEXT`: Read in a file of secret environment variables.
2935
2935
*`-e, --env TEXT`: Set environment variables. E.g. --env ENV=value
2936
2936
*`--env-file TEXT`: Read in a file of environment variables.
2937
+
*`-v, --volume TEXT`: Mount a volume. Format: hf://[TYPE/]SOURCE:/MOUNT_PATH[:ro]. TYPE is one of: models, datasets, spaces, buckets. TYPE defaults to models if omitted. models, datasets and spaces are always mounted read-only. buckets are read+write by default.E.g. -v hf://gpt2:/data or -v hf://datasets/org/ds:/data or -v hf://buckets/org/b:/mnt:ro
*`--secrets-file TEXT`: Read in a file of secret environment variables.
3041
3043
*`-e, --env TEXT`: Set environment variables. E.g. --env ENV=value
3042
3044
*`--env-file TEXT`: Read in a file of environment variables.
3045
+
*`-v, --volume TEXT`: Mount a volume. Format: hf://[TYPE/]SOURCE:/MOUNT_PATH[:ro]. TYPE is one of: models, datasets, spaces, buckets. TYPE defaults to models if omitted. models, datasets and spaces are always mounted read-only. buckets are read+write by default.E.g. -v hf://gpt2:/data or -v hf://datasets/org/ds:/data or -v hf://buckets/org/b:/mnt:ro
0 commit comments