Enable IPFS model loading for Hugging Face Transformers
Project description
Transformers_IPFS
Load models directly from IPFS for Hugging Face Transformers.
Features
- 🌐 Direct integration with local IPFS nodes (preferred method)
- 🔄 Automatic fallback to IPFS gateways when local node isn't available
- 🔍 Simple URI format:
ipfs://CIDfor easy model sharing - ⚡ Zero configuration required - works automatically once installed
- 🧩 Compatible with any version of Transformers
Installation
# Note: PyPI package names use hyphens
pip install transformers-ipfs
transformers-ipfs activate
Once installed and activated, the transformers_ipfs integration will be loaded automatically whenever you use Python.
Usage
Use the Transformers library with IPFS model URIs:
from transformers import AutoModel, AutoTokenizer
# Load a model directly from IPFS
tokenizer = AutoTokenizer.from_pretrained("ipfs://bafybeichqdarufyutqc7yd43k77fkxbmeuhhetbihd3g32ghcqvijp6fxi")
model = AutoModel.from_pretrained("ipfs://bafybeichqdarufyutqc7yd43k77fkxbmeuhhetbihd3g32ghcqvijp6fxi")
IPFS Node Connectivity
The transformers_ipfs package prioritizes connectivity in the following order:
-
Local IPFS Node (Recommended): If you have an IPFS daemon running locally (
ipfs daemon), the package will automatically detect and use it. This method:- Is much faster for repeated downloads
- More reliably loads complex model directories with multiple files
- Contributes to the IPFS network by providing content to others
-
IPFS Gateway (Fallback): If a local node isn't available, the package will fall back to public gateways. This method:
- Works without installing IPFS
- May be less reliable for complex model directories
- Downloads can be interrupted more easily
Command Line Interface
# Note: CLI commands use hyphens
# Activate the auto-loading
transformers-ipfs activate
# Check if the integration is active
transformers-ipfs status
# Test the integration
transformers-ipfs test
# Deactivate the integration
transformers-ipfs deactivate
Dependencies
- Python 3.7+
- transformers
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file transformers_ipfs-0.1.0.tar.gz.
File metadata
- Download URL: transformers_ipfs-0.1.0.tar.gz
- Upload date:
- Size: 16.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
45419cbcae58859a19779ee20971c22e0562930956581320a9c9cbe39d808365
|
|
| MD5 |
feaa530d07e4ed37a99c27e47125e3f1
|
|
| BLAKE2b-256 |
034b4d48ae4a1c33e8b7e927761995e984c0533fd81db773583c640d4d891c9c
|
Provenance
The following attestation bundles were made for transformers_ipfs-0.1.0.tar.gz:
Publisher:
publish.yml on alexbakers/transformers_ipfs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
transformers_ipfs-0.1.0.tar.gz -
Subject digest:
45419cbcae58859a19779ee20971c22e0562930956581320a9c9cbe39d808365 - Sigstore transparency entry: 187382955
- Sigstore integration time:
-
Permalink:
alexbakers/transformers_ipfs@e0ff19eaa0a38232933f6741465c7e91d87ffe0d -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/alexbakers
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e0ff19eaa0a38232933f6741465c7e91d87ffe0d -
Trigger Event:
release
-
Statement type:
File details
Details for the file transformers_ipfs-0.1.0-py3-none-any.whl.
File metadata
- Download URL: transformers_ipfs-0.1.0-py3-none-any.whl
- Upload date:
- Size: 14.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
234f71ed5cf104b3741a413d1b419aa273bc64d204da1253503a0f5d3a346352
|
|
| MD5 |
7fcf94334f3c386de0f8c603a7b1f934
|
|
| BLAKE2b-256 |
c4e62c6e64b7563f2e918e3c7f94ad7e0ea9d94f3205d2f741248f7da9ba2685
|
Provenance
The following attestation bundles were made for transformers_ipfs-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on alexbakers/transformers_ipfs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
transformers_ipfs-0.1.0-py3-none-any.whl -
Subject digest:
234f71ed5cf104b3741a413d1b419aa273bc64d204da1253503a0f5d3a346352 - Sigstore transparency entry: 187382957
- Sigstore integration time:
-
Permalink:
alexbakers/transformers_ipfs@e0ff19eaa0a38232933f6741465c7e91d87ffe0d -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/alexbakers
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e0ff19eaa0a38232933f6741465c7e91d87ffe0d -
Trigger Event:
release
-
Statement type: