A simple command-line tool to transfer models and datasets from the Hugging Face Hub to the ModelScope Hub.
- Supports both models and datasets.
- Transfer multiple repositories in a single command.
- Option to specify a custom repository name on ModelScope.
- Automatic repository naming with collision handling (appends a timestamp if the name exists).
- Configure credentials using a
.envfile or command-line arguments. - Transfer into public or private repositories.
pip install hf-ms-transferCreate a .env file in your project directory and add your ModelScope token and username. You can get your token from the ModelScope user center.
# .env
ms_token="your_modelscope_token"
ms_name="your_modelscope_username"Alternatively, you can provide the token and username directly as command-line arguments.
hf-ms-transfer <hf_repo_ids> [options]<hf_repo_ids>: (Required) One or more Hugging Face repository IDs, separated by commas (e.g.,bert-base-uncased,stanfordnlp/imdb).--ms-token <token>: (Optional) Your ModelScope access token. Overrides the value in the.envfile.--ms-name <username>: (Optional) Your ModelScope username. Overrides the value in the.envfile.--ms-repo-name <name>: (Optional) A custom name for the repository on ModelScope.Note: This option cannot be used when transferring multiple repositories.
--private: (Optional) Create the ModelScope repository as private. Defaults to public.--keep-dataset-infos: (Optional) For datasets, upload thedataset_infos.jsonfile. By default, this file is excluded as it can cause issues when usingload_datastesfunction.