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

# Note: PyPI package names use hyphens
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(
    repo_id="ipfs://bafybeie7quk74kmqg34nl2ewdwmsrlvvt6heayien364gtu2x6g2qpznhq",
    filename="ggml-model-Q4_K_M.gguf"
)

# Use the model normally
response = model.create_completion(
    "Once upon a time",
    max_tokens=128
)

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

# Note: CLI commands use hyphens
# 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.1.0.tar.gz (13.8 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.1.0-py3-none-any.whl (13.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: llama_ipfs-0.1.0.tar.gz
  • Upload date:
  • Size: 13.8 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.1.0.tar.gz
Algorithm Hash digest
SHA256 d7b0876e40220596ab9bf228b282dba6d2725371e1d7de5781cab34f56e56c8f
MD5 9bc71f9606938cffddf4aaf8a6c67166
BLAKE2b-256 2a8b0d50dd3958cee8645b4e89a5f89d33238ee16fef4184a48981f5d69bc837

See more details on using hashes here.

Provenance

The following attestation bundles were made for llama_ipfs-0.1.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.1.0-py3-none-any.whl.

File metadata

  • Download URL: llama_ipfs-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 13.2 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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8b4476b346052932dba213d3fe3033ef0718f5441a06635579d5d0d765ad9ab3
MD5 0f66f265a4977e8555d7102f1a1fef1e
BLAKE2b-256 3c67510efeb52203243457184dcac4c332d6d71e86d2b06713ea4fa8726cae01

See more details on using hashes here.

Provenance

The following attestation bundles were made for llama_ipfs-0.1.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