Skip to main content

Universal model weight exporter for multiple formats and inference engines

Project description

model-exporter

Export HuggingFace models to different formats for inference.

Installation

pip install model-exporter

Supported Models

  • GPT-2 family: gpt2, gpt2-medium, gpt2-large, gpt2-xl, distilgpt2

Supported Formats

  • binary - Simple binary format for C++ inference
  • safetensors - Fast and safe tensor format

Usage

Export a model

model-exporter export MODEL_NAME --format FORMAT --output OUTPUT_DIR

Options:

  • --format - Export format (binary or safetensors)
  • --output - Output directory (default: ./weights)
  • --info - Print model info before export
  • --no-vocab - Skip vocabulary export

Examples

# Export with model info
model-exporter export gpt2-medium --format binary --output ./my_weights --info

# Export without vocabulary
model-exporter export distilgpt2 --format binary --no-vocab

Python API

from model_exporter import get_exporter

# Create exporter
exporter = get_exporter('gpt2')

# Load model
exporter.load_model()

# Export
exporter.export(output_dir='./weights', format_name='binary')

Work in Progress

We're actively working on adding support for:

Model Families

  • LLaMA/LLaMA-2 - Meta's LLaMA models
  • BERT - BERT and variants (RoBERTa, DistilBERT)
  • T5/FLAN-T5 - Encoder-decoder models
  • Mistral/Mixtral - Mistral AI models

Export Formats

  • GGUF - llama.cpp compatible format with quantization
  • ONNX - Cross-platform inference format
  • TensorFlow Lite - Mobile inference format

Features

  • Quantization - int8, int4 quantization support
  • Model sharding - Split large models across multiple files
  • Batch export - Export multiple models at once

Want to contribute? Check out our GitHub repository!

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

model_exporter-0.1.1.tar.gz (10.5 kB view details)

Uploaded Source

Built Distribution

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

model_exporter-0.1.1-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

File details

Details for the file model_exporter-0.1.1.tar.gz.

File metadata

  • Download URL: model_exporter-0.1.1.tar.gz
  • Upload date:
  • Size: 10.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.12

File hashes

Hashes for model_exporter-0.1.1.tar.gz
Algorithm Hash digest
SHA256 be3577e1e4886e513503ff112e66eceb5babc5ec9e47b2ba87aedfbddb16ea5a
MD5 3769da2d008a9e0bbcb7c70116a340c7
BLAKE2b-256 19641fc7a17f1d9bdd5080ff8443e74c10168b7e9c4d61931f97520990de682b

See more details on using hashes here.

File details

Details for the file model_exporter-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: model_exporter-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 11.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.12

File hashes

Hashes for model_exporter-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 08a647080960db570ada70cda09e93f84fe00033d7d4d07ebe5a649bcdcd4bbc
MD5 3577da1fc84de847321e32537bc6a05d
BLAKE2b-256 c65d5931a51b283b0a302907d22e62468f69610297fe0dba80cd593404095a15

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