Skip to main content

Lightweight local Hugging Face Hub server and client

Project description

hf-local-hub

Lightweight local Hugging Face Hub server and client - run HF Hub entirely on your machine.

Go Python License Docker Tests

Table of Contents

Features

  • Single Binary: Static Go binary (~53MB), no runtime dependencies
  • Full API Compatibility: Emulates essential Hugging Face Hub API
  • Zero Configuration: Works out of the box
  • Python Integration: Seamless with huggingface_hub, transformers, diffusers
  • Local Storage: All models and datasets stored on your filesystem
  • Cross-Platform: Linux, macOS, Windows
  • Docker Support: Multi-stage Docker image
  • Comprehensive Testing: Unit and integration tests

Quick Start

1. Install

Go Binary:

# Clone repository
git clone https://github.com/lyani/hf-local-hub.git
cd hf-local-hub

# Build server
make server

Python Package:

# Clone and install
git clone https://github.com/lyani/hf-local-hub.git
cd hf-local-hub/python
pip install -e .

Docker:

# Pull or build
docker build -t hf-local .
docker run -p 8080:8080 -v $(pwd)/data:/app/data hf-local

2. Start Server

# Using Go binary
./hf-local

# Using Python CLI
hf-local serve --port 8080

3. Use with Hugging Face Libraries

# Set endpoint
export HF_ENDPOINT=http://localhost:8080

# Download models
huggingface-cli download user/my-model

# Or use in Python
python -c "
from transformers import AutoModel
model = AutoModel.from_pretrained('user/my-model')
"

Installation

Requirements

  • Go: 1.25+ (for building server)
  • Python: 3.11+ (for Python client)
  • Disk Space: ~100MB minimum (varies by model size)

Build from Source

# Clone repository
git clone https://github.com/lyani/hf-local-hub.git
cd hf-local-hub

# Build Go server
make server

# Install Python package
cd python
pip install -e ".[dev]"

Install via pip (Future)

pip install hf-local

Documentation

Examples

See docs/examples/ directory for complete examples:

Architecture

┌─────────────────┐
│   Client Apps   │  (Transformers, Diffusers, etc.)
└────────┬────────┘
         │ HF_ENDPOINT=http://localhost:8080
         ▼
┌─────────────────┐
│  Go Server      │  (Gin + SQLite)
│  - API Layer    │
│  - File Serving │
│  - Auth (opt)   │
└────────┬────────┘
         │
         ▼
┌─────────────────┐
│  Local FS       │  (data/storage/models/...)
└─────────────────┘

Development

Setup

# Clone repository
git clone https://github.com/lyani/hf-local-hub.git
cd hf-local-hub

# Install Python dependencies
cd python
pip install -e ".[dev]"

Run Tests

# All tests
make test

# Go tests only
make server-test

# Python tests only
make python-test

Linting

# All linters
make lint

# Go lint
make server-lint

# Python lint
make python-lint

Docker

# Build image
make docker-build

# Run container
make docker-run

# Stop container
make docker-down

Development Workflow

  1. Create feature branch: git checkout -b feat/your-feature
  2. Make changes and commit with conventional commits
  3. Run tests and linting: make test lint
  4. Push and create pull request

Contributing

  • Phase 0: Project Initialization
  • Phase 1: Go Server Core
  • Phase 2: Python Package & CLI
  • Phase 3: Full HF Compatibility
  • Phase 4: Packaging & Documentation
  • Phase 5: CI/CD & GitHub Readiness

License

MIT License - see LICENSE file

Contributing

Contributions welcome! See CONTRIBUTING.md for guidelines.

Project Status

  • Phase 0: Project Initialization
  • Phase 1: Go Server Core
  • Phase 2: Python Package & CLI
  • Phase 3: Full HF Compatibility
  • Phase 4: Packaging & Documentation
  • Phase 5: CI/CD & GitHub Readiness

Current Release

Version 0.1.0 - March 1, 2026

Installation

# From PyPI (after v0.1.0 release)
pip install hf-local

# Or install from source
git clone https://github.com/Akicou/hf-local-hub.git
cd hf-local-hub
make server
cd python && pip install -e .

Quick Start

# Start server
hf-local serve --port 8080

# Set HF_ENDPOINT
export HF_ENDPOINT=http://localhost:8080

# Use with huggingface_hub
python -c "
from huggingface_hub import snapshot_download
snapshot_download('user/my-model')
"

What's Included

  • ✅ Go server with REST API (single binary)
  • ✅ Python CLI and library
  • ✅ Full Hugging Face Hub compatibility
  • ✅ Upload/download workflows
  • ✅ Transformers and Diffusers integration
  • ✅ Docker support
  • ✅ Comprehensive tests
  • ✅ Complete documentation

Documentation

Source & Releases

Support

Acknowledgments

Built with:

Roadmap

v0.2.0

  • Authentication and authorization
  • User management
  • Repository access control
  • Git operations (branches, tags)
  • Model metadata search

v0.3.0

  • Web UI for repository management
  • Model card editor
  • File preview
  • Model sharing features
  • Integration with CI/CD

Support

Star History

Star History Chart

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

hf_local_hub-0.1.0.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

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

hf_local_hub-0.1.0-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: hf_local_hub-0.1.0.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for hf_local_hub-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4f3477d78c7029ed997e35edb52eb38016cf27217d51f2f10053483707e454b5
MD5 cbc4e952928a675c88395030c8b7b1dd
BLAKE2b-256 d3789aa5932cb774842534bc8324e81b44719498aa83ce87f76bfab003136c5f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hf_local_hub-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for hf_local_hub-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 23d47f29b75c65b82366854c75a6082b07a976175ff37dec4f7f8d72b6b0a450
MD5 6089f9dbd27ccdb7ec7ffd71bb6c5466
BLAKE2b-256 f7255b46ea98848ebbdf71f8ea14652ef25b56104c707b5541d59bfcd35bf318

See more details on using hashes here.

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