Skip to main content

Enable IPFS model loading for llama-cpp-python

Project description

Llama_IPFS

Load models directly from IPFS for llama-cpp-python.

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 llama-cpp-python

Installation

pip install llama-ipfs
llama-ipfs activate

Once installed and activated, the llama_ipfs integration will be loaded automatically whenever you use Python.

Usage

After installation, use llama-cpp-python with IPFS model URIs:

from llama_cpp import Llama

# Load a model directly from IPFS
model = Llama.from_pretrained(
    # Equivalent HuggingFace model: "aisuko/gpt2-117M-gguf"
    repo_id = "ipfs://bafybeie7quk74kmqg34nl2ewdwmsrlvvt6heayien364gtu2x6g2qpznhq",
    filename = "ggml-model-Q4_K_M.gguf"
)

IPFS Node Connectivity

The llama_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
    • 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

# Activate the auto-loading
llama-ipfs activate

# Check if the integration is active
llama-ipfs status

# Test the integration
llama-ipfs test

# Deactivate the integration
llama-ipfs deactivate

Dependencies

  • Python 3.8+
  • llama-cpp-python

License

MIT License

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

llama_ipfs-0.2.0.tar.gz (14.4 kB view details)

Uploaded Source

Built Distribution

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

llama_ipfs-0.2.0-py3-none-any.whl (13.8 kB view details)

Uploaded Python 3

File details

Details for the file llama_ipfs-0.2.0.tar.gz.

File metadata

  • Download URL: llama_ipfs-0.2.0.tar.gz
  • Upload date:
  • Size: 14.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for llama_ipfs-0.2.0.tar.gz
Algorithm Hash digest
SHA256 0f069bce48dcb67da4e8eab0275f0a7b4cb0101f1e18208da6a319cbbf50151e
MD5 4264930b9dc420fc011b00bc5c847ca6
BLAKE2b-256 a9c506c74d4430be406da5077150995003e82f7c27a553e0897314115f5a3963

See more details on using hashes here.

Provenance

The following attestation bundles were made for llama_ipfs-0.2.0.tar.gz:

Publisher: publish.yml on alexbakers/llama_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 llama_ipfs-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: llama_ipfs-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 13.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for llama_ipfs-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 830e8c8b702a97263238e38f8d03b5b8183ea0b5ca5f07090b07f87d654b7a62
MD5 7419ef336a7e4bed6a6b460ef63e6557
BLAKE2b-256 22f1e25dc1dd91cb75568d2d9dc51a72aac702a680d65642d8a86f1a7ea47205

See more details on using hashes here.

Provenance

The following attestation bundles were made for llama_ipfs-0.2.0-py3-none-any.whl:

Publisher: publish.yml on alexbakers/llama_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