convert-to-onnx / README.md
Felladrin's picture
Add Docker Compose setup and simplify environment configuration
783645d
metadata
title: Convert to ONNX
emoji: 
colorFrom: indigo
colorTo: yellow
sdk: docker
app_port: 8501
pinned: true
license: apache-2.0
short_description: Convert a Hugging Face model to ONNX format

Convert to ONNX

Overview

This project provides a Streamlit application that facilitates the conversion of Hugging Face models to ONNX format, downloading, converting, and uploading models to Hugging Face.

Docker Compose usage

1. Prepare environment variables

Copy the provided template and fill in your Hugging Face write token:

cp .env.example .env

2. Start the application

docker compose up

Access the interface at http://localhost:8501.

Enter a Hugging Face model ID (e.g., EleutherAI/pythia-14m).

After a successful conversion, the ONNX export is available under {username}/{model-name}-ONNX unless you opt into reusing the same repository.

To stop the service, press Ctrl+C (or run docker compose down). Add -d to run detached.

Direct Docker usage (optional)

If you prefer not to use Docker Compose, you can still build and run manually:

docker build -t convert-to-onnx .

docker run --rm \
  -p 8501:8501 \
  -e HF_TOKEN="your_write_token" \
  convert-to-onnx

Development

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Implement changes with tests
  4. Submit a pull request

Troubleshooting

Common issues and solutions:

  • Authentication Errors: Verify your Hugging Face credentials
  • Conversion Failures: Check model compatibility and available disk space
  • Upload Issues: Ensure stable internet connection and valid permissions

License

Apache 2.0 License