Skip to main content

A package that downloads a model from the HuggingFace Model Hub.

Project description

HFDownloader - Hugging Face Model Downloader

This package provides the user with one method that downloads a tokenizer and model from HuggingFace Model Hub to a local path.

This package utilizes the transformers library to download a tokenizer and model using just one method. When a model is downloaded, it will save a state from a loaded tokenizer and model to a local path. If the path does not exist, the method will create one with the title passed.

This Github repo also allows you to run 'hf_downloader.py' like a script if you don't want to open a python terminal. It has two positional arguments, the model and the pathname you wish the model to save to. Example usage may look something like this in the command line.

python hf_downloader.py cardiffnlp/twitter-roberta-base-sentiment sentiment_model_path

Installation

The package can be installed with the following command:

pip install hfdownloader

How to Use

Here is a bit of code you can reference to see how to use the package. I will be using another package I released called HFLoader, that simply loads the tokenizer and model. You can do this in any way, this package is not required.

import hlfloader as hfl
import hfdownload as hfd

huggingface_model = "cardiffnlp/twitter-roberta-base-sentiment"
tokenizer, model = hfl.load_model(huggingface_model)
hfd.save_model("HuggingFaceModelPath", tokenizer, model)

The code above is the easiest way I have found to save models from the HuggingFace Model Hub locally.

Requirements

pip install transformers

Not required but helpful

pip install hfloader

Notes

I don't have plans to upkeep this project unless it necessitates it. I was able to achieve the goal I had set out when developing the package.

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

hfdownloader-1.0.1.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

hfdownloader-1.0.1-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

Details for the file hfdownloader-1.0.1.tar.gz.

File metadata

  • Download URL: hfdownloader-1.0.1.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for hfdownloader-1.0.1.tar.gz
Algorithm Hash digest
SHA256 57db2fd25930c9c5d30721b8a980605e2e2f39c3a1d6cbe23724f23e98d2925d
MD5 cf1702ec299152a9fec207a99b267b3e
BLAKE2b-256 6ac4024efeba20fe6cdca20f796d6fb7056343f0b633e1b9ed64a922bbc2cd48

See more details on using hashes here.

File details

Details for the file hfdownloader-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for hfdownloader-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5a77851a0c2986f825448a2467131994c6e0562c91cf7dc10b1bcc65af3aa79d
MD5 5724411657316a33259056b7e72968de
BLAKE2b-256 f1be6215cf1f91484206eabfcfa72a3a3203284faf04967659f8c9985f075826

See more details on using hashes here.

Supported by

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