Carve/LaMa-ONNX
By Carve · ↓ 0 · ♥ 50 · Updated 2024-05-15
What's in this repo
This page lists the files in Carve/LaMa-ONNX, including lama.onnx, lama_fp32.onnx.
- 2 ONNX models (.onnx files)
- 9 files, including 4 .png, 2 .onnx, 1 .md, 1 .jpg
- Repository size ~397 MB
- Last updated 2024-05-15
ONNX files
How to use
These ONNX files can be loaded with ONNX Runtime. To inspect a model graph, upload the file to the Netron viewer. Download links point to the original files on Hugging Face.
README
LaMa Inpainting Model
This ONNX model is a port of the original PyTorch big-lama model.
HG Space: https://huggingface.co/spaces/Carve/LaMa-Demo-ONNX
Description
There are two versions of the model:
1. lama_fp32.onnx (RECOMMENDED)
This version was exported using the old torch to ONNX converter (torch.onnx.export).
Notes:
- Custom FourierUnitJIT: A custom FourierUnitJIT implementation is used since the original cannot be directly ported to ONNX without overhead. The result is identical to the original model.
- Fixed Input Shape: The input shape is fixed at 512x512 pixels. Although dynamic input shapes are possible, they would require resolving issues with dynamic padding in the
irfftandrfftnfunctions inffc.py. - Opset Version 17: This model uses opset version 17.
- Exportable to TensorRT: The model can be successfully used in TensorRT, etc.
if you need other resolution - export it using our jupyter notebook
2. lama.onnx (NOT RECOMMENDED)
This version was exported using the new torch to ONNX converter (torch.onnx.dynamo_export).
Notes:
- Custom DFT irfftn Logic: Uses a custom irfftn ONNX logic (patched
onnxscript). - Fixed Input Shape: The input shape is fixed at 512x512 pixels.
- Opset Version 18: This model uses opset version 18.
- Performance: The model works slowly due to issues with
torch.onnx.dynamo_exportand optimization of the ONNX model.
Resources
- Original repository: advimman/lama
- Repository with custom implementation of exportable LaMa: Carve-Photos/lama
Example
Original image:

lama_fp32.onnx - output:

lama.onnx - output:

Original model output:

Model info
Created: 2024-05-10
Updated: 2024-05-15
View on Hugging FaceFiles (9)
Related models
More from Carve
No other models by this author.