Skip to main content

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.

Release files for hfdownloader 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hfdownloader 1.0.2
File Size Uploaded
hfdownloader-1.0.2.tar.gz 2.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for hfdownloader 1.0.2
File Interpreter ABI Platform
hfdownloader-1.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 6.2 kB

Release files / hfdownloader-1.0.2.tar.gz

Download URL hfdownloader-1.0.2.tar.gz
Size 2.9 kB
Tags Source
SHA-256 checksum
How to use checksums
416a90420a997508fc98639d12b5a265762783f9f39c22c95085c973c6e814a4
BLAKE2b-256 checksum
How to use checksums
88bd8e82f4ed93904aeaf6f48a54c6e76813cdf566ddb6f52db2ff8d9253ef19
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.5

Release files / hfdownloader-1.0.2-py3-none-any.whl

Download URL hfdownloader-1.0.2-py3-none-any.whl
Size 3.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d9b556165f1d3f3d2a62a2248fc533b186127cefe6f94539a9af975147fd21fa
BLAKE2b-256 checksum
How to use checksums
b448e314bffcfe4ea4cac83dbaabc15b5c9406799cd8daec3cdd58c8819e9523
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.5

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files

1.0.1

2 release files

1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page