File size: 1,709 Bytes
d088d6c
 
 
 
 
9f538bd
 
9bfcf12
d088d6c
f2501ef
d088d6c
f2501ef
 
 
 
 
783645d
f2501ef
783645d
f2501ef
783645d
f2501ef
783645d
f2501ef
783645d
 
 
f2501ef
783645d
f2501ef
783645d
 
 
f2501ef
783645d
f2501ef
783645d
f2501ef
783645d
f2501ef
783645d
f2501ef
783645d
f2501ef
783645d
f2501ef
783645d
 
f2501ef
783645d
 
 
 
 
f2501ef
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
---
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:

```bash
cp .env.example .env
```

### 2. Start the application

```bash
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:

```bash
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](license.txt)