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.1.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.1-py3-none-any.whl (14.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: modely_ai-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 f0bf12c52b9a04f570d47f2ebf1bc23825beb4ed2d94a74e99540e09447b9241
MD5 78abfa1dc221475d74c5968fd5cf1b5e
BLAKE2b-256 d704f63e9ac804732b7163a1de550d658098dff1a6e76dbf8543386e39db7590

See more details on using hashes here.

File details

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

File metadata

  • Download URL: modely_ai-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3a471b907005d71660dfc1bbf7a301e07204f4007711d1ff98caf3e9ce79fd55
MD5 17c99dc257a987ebde3a210d5b6e66bb
BLAKE2b-256 e0b53f92180b4472624c7a08851c2b5003378bc32be17b5a3e8405c83d59d7c0

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