Skip to main content

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://CID for 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:

  1. 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
  2. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

transformers_ipfs-0.1.0.tar.gz (16.9 kB view details)

Uploaded Source

Built Distribution

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

transformers_ipfs-0.1.0-py3-none-any.whl (14.6 kB view details)

Uploaded Python 3

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

Hashes for transformers_ipfs-0.1.0.tar.gz
Algorithm Hash digest
SHA256 45419cbcae58859a19779ee20971c22e0562930956581320a9c9cbe39d808365
MD5 feaa530d07e4ed37a99c27e47125e3f1
BLAKE2b-256 034b4d48ae4a1c33e8b7e927761995e984c0533fd81db773583c640d4d891c9c

See more details on using hashes here.

Provenance

The following attestation bundles were made for transformers_ipfs-0.1.0.tar.gz:

Publisher: publish.yml on alexbakers/transformers_ipfs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file transformers_ipfs-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for transformers_ipfs-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 234f71ed5cf104b3741a413d1b419aa273bc64d204da1253503a0f5d3a346352
MD5 7fcf94334f3c386de0f8c603a7b1f934
BLAKE2b-256 c4e62c6e64b7563f2e918e3c7f94ad7e0ea9d94f3205d2f741248f7da9ba2685

See more details on using hashes here.

Provenance

The following attestation bundles were made for transformers_ipfs-0.1.0-py3-none-any.whl:

Publisher: publish.yml on alexbakers/transformers_ipfs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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