feat: add instructions to export to onnx
This commit is contained in:
parent
780a5688a0
commit
6a70a46042
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
|
@ -17,7 +17,7 @@
|
|||
// "--ckpt_path",
|
||||
// "${workspaceFolder}/lightning_logs/version_264/checkpoints/epoch=9-st&ep=1000.ckpt",
|
||||
"--data.num_workers",
|
||||
"0",
|
||||
"1",
|
||||
"--trainer.benchmark",
|
||||
"false",
|
||||
"--trainer.num_sanity_val_steps",
|
||||
|
|
11
README.md
11
README.md
|
@ -28,6 +28,17 @@ Start inference on images:
|
|||
python src/main.py predict --ckpt_path <path_to_checkpoint>
|
||||
```
|
||||
|
||||
Quick and dirty way to export to `.onnx`:
|
||||
```python
|
||||
>>> from src.module import DETR
|
||||
>>> checkpoint = "<path_to_checkpoint>"
|
||||
>>> model = DETR.load_from_checkpoint(checkpoint)
|
||||
>>> model.net.save_pretrained("hugginface_checkpoint")
|
||||
```
|
||||
```bash
|
||||
python -m transformers.onnx --model=hugginface_checkpoint onnx_export/
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
Distributed under the [MIT](https://choosealicense.com/licenses/mit/) license. \
|
||||
|
|
Loading…
Reference in a new issue