Skip to main content

A simple modelscope client for Python.

Project description

shiertier_modelscope

English | 中文

Introduction

shiertier_modelscope is a Python client for interacting with the ModelScope platform. It provides a simple interface for downloading and uploading models, with support for automatic login using environment variables. This library is designed to streamline the process of managing models on ModelScope.

Installation

You can install shiertier_modelscope via pip:

pip install git+https://github.com/shiertier/shiertier_modelscope.git

Please note that this project is still under development.

Usage

Downloading Models

You can download models from ModelScope using the download method. This method requires the repository name and the directory where the model files should be saved. You can also specify a specific file to download using the file_path parameter. Downloading models from public repositories does not require a token.

from shiertier_modelscope import easy_modelscope

# Download the entire repository
easy_modelscope.download(repo_name='my_public_model_repo', save_dir='path/to/save_directory')

# Download a specific file from the repository
easy_modelscope.download(repo_name='my_public_model_repo', save_dir='path/to/save_directory', file_path='path/to/file_in_repo')

# Download from a private repository (requires token)
client = ModelScopeClient(MODELSCOPE_TOKEN='your_token_here')
client.download(repo_name='my_private_model_repo', save_dir='path/to/save_directory')

Uploading Models

You can upload models to ModelScope using the upload_models method. This method requires the local directory containing the model files and the repository name. Note that uploading models requires a valid token.

from shiertier_modelscope import ModelScopeClient

# Initialize with a token
client = ModelScopeClient(MODELSCOPE_TOKEN='your_token_here')

# Upload models
client.upload_models(model_dir='path/to/model_directory', repo_name='my_model_repo')

Initialization

To use the ModelScopeClient, you need to initialize it with your ModelScope token. If the token is not provided during initialization, it will attempt to retrieve it from the MODELSCOPE_TOKEN environment variable.

from shiertier_modelscope import ModelScopeClient, easy_modelscope

# Initialize with a token
client = ModelScopeClient(MODELSCOPE_TOKEN='your_token_here')

# Or use the easy_modelscope shortcut
# easy_modelscope

Environment Variables

  • MODELSCOPE_TOKEN: The token used for authentication with the ModelScope platform. If not provided during initialization, the client will attempt to retrieve it from this environment variable.

Dependencies

  • modelscope

License

This project is released under the MIT License. See the LICENSE file for details.

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

shiertier_modelscope-0.0.1.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

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

shiertier_modelscope-0.0.1-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file shiertier_modelscope-0.0.1.tar.gz.

File metadata

  • Download URL: shiertier_modelscope-0.0.1.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for shiertier_modelscope-0.0.1.tar.gz
Algorithm Hash digest
SHA256 4cd0ade1db9c4a4b8f99bcede5c8997430fe8a78b3c8e3549340c0c06332ce70
MD5 c3d526e60c2dcce28bf7490beaab7e20
BLAKE2b-256 f40a574e4203c7eac2f03630a320b6611bd6ffb57116820781c58a19160c7a2e

See more details on using hashes here.

File details

Details for the file shiertier_modelscope-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for shiertier_modelscope-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 455f7095a4331a0c5fb82203def3b87ace14956294a6d5bf80aa69a47b4edf01
MD5 e89553457e7852ca1b0cfa65bfe881d0
BLAKE2b-256 c596b760c48f74bff1f98b3cbc36f7cd52e3758e5c319d440c4a74ad39a046ea

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