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.2.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: hfdownloader-1.0.2.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.2.tar.gz
Algorithm Hash digest
SHA256 416a90420a997508fc98639d12b5a265762783f9f39c22c95085c973c6e814a4
MD5 fa1ce70c67f7905b50558b8bc1784260
BLAKE2b-256 88bd8e82f4ed93904aeaf6f48a54c6e76813cdf566ddb6f52db2ff8d9253ef19

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hfdownloader-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d9b556165f1d3f3d2a62a2248fc533b186127cefe6f94539a9af975147fd21fa
MD5 f3465ae1d2cc47f6a2f23f228886ae0e
BLAKE2b-256 b448e314bffcfe4ea4cac83dbaabc15b5c9406799cd8daec3cdd58c8819e9523

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