Skip to main content

AI models download in one command

Project description

modely-ai

modely-ai is a Python package that provides a unified interface for downloading AI models and datasets from multiple platforms including Hugging Face and ModelScope. It offers a simple command-line tool and Python API to efficiently download models and datasets with progress tracking, resumable downloads, and minimal dependencies.

Features

  • 🚀 Unified interface: Download from both Hugging Face and ModelScope with a single tool
  • Progress tracking: Real-time download progress with tqdm
  • 🔄 Resumable downloads: Resume interrupted downloads automatically
  • 📁 Flexible options: Download entire repositories or specific files
  • 🔐 Authentication support: Access private models and datasets with tokens
  • 📦 Minimal dependencies: Only requires requests and tqdm

Installation

Install modely-ai using pip:

pip install modely-ai

Usage

Command Line Interface

modely-ai provides a command-line interface with two main subcommands: hf for Hugging Face and ms for ModelScope.

Download from Hugging Face

Download an entire model repository:

modely hf bert-base-uncased

Download a specific file from a repository:

modely hf bert-base-uncased --file config.json

Download with specific options:

modely hf facebook/opt-2.7b --repo-type model --revision v1.1.0 --local-dir ./models

Download from a private repository:

modely hf username/private-repo --token YOUR_HUGGINGFACE_TOKEN

Download from ModelScope

Download an entire model repository:

modely ms owner/model-name

Download a specific file:

modely ms owner/model-name --file config.json

Download a dataset:

modely ms owner/dataset-name --repo-type dataset

Download with specific options:

modely ms owner/model-name --revision main --local-dir ./models

Python API

You can also use modely-ai directly in your Python code:

from modely import hf_snapshot_download, model_file_download

# Download an entire Hugging Face repository
model_path = hf_snapshot_download(
    repo_id="bert-base-uncased",
    repo_type="model",
    revision="main"
)

# Download a specific file from Hugging Face
file_path = hf_file_download(
    repo_id="bert-base-uncased",
    filename="config.json",
    repo_type="model"
)

# Download from ModelScope
ms_model_path = modelscope_snapshot_download(
    repo_id="owner/model-name",
    repo_type="model",
    revision="master"
)

Command Reference

Hugging Face Commands

modely hf <repo_id> [OPTIONS]

Options:

  • --file FILE: Specific file path to download from the repository
  • --repo-type {model,dataset,space}: Type of repository (default: model)
  • --revision REVISION: Revision of the model (default: main)
  • --cache-dir DIR: Cache directory for downloaded files
  • --local-dir DIR: Local directory to download files to
  • --token TOKEN: Access token for private repositories
  • --force-download: Force re-download even if file exists

ModelScope Commands

modely ms <repo_id> [OPTIONS]

Options:

  • --file FILE: Specific file path to download from the repository
  • --repo-type {model,dataset}: Type of repository (default: model)
  • --revision REVISION: Revision of the model (default: master)
  • --cache-dir DIR: Cache directory for downloaded files
  • --local-dir DIR: Local directory to download files to
  • --token TOKEN: Access token for private models

Requirements

  • Python 3.10 or higher
  • requests >= 2.25.0
  • tqdm >= 4.62.0

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

Contributions are welcome! Feel free to submit a pull request or open an issue to improve the functionality or documentation.

Support

If you encounter any issues or have questions, please open an issue on the GitHub repository.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

modely_ai-0.1.0.tar.gz (14.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

modely_ai-0.1.0-py3-none-any.whl (14.7 kB view details)

Uploaded Python 3

File details

Details for the file modely_ai-0.1.0.tar.gz.

File metadata

  • Download URL: modely_ai-0.1.0.tar.gz
  • Upload date:
  • Size: 14.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.8

File hashes

Hashes for modely_ai-0.1.0.tar.gz
Algorithm Hash digest
SHA256 bacab042b2dcc89828fc72ba2c58e1d8a98fd6ff5b0a87ff86f73483e9a4147e
MD5 6db6465f93b6c8eed062a93b56775d53
BLAKE2b-256 cbac5e00aa9549a37e8c1eaa836cd4e5ca6ec1b65e588989e8ae1f23c433edf8

See more details on using hashes here.

File details

Details for the file modely_ai-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: modely_ai-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 14.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.8

File hashes

Hashes for modely_ai-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 619604d5f749f0a222f85df0a6007c420ad7ebab898209d395d18f5feb69c833
MD5 c481459fa582cbfa0bee0275acf8ab20
BLAKE2b-256 79ffaf8224f1334f3e852cc6c67e5a4ba4544cec04e85a9aca09fa2bb458d971

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page