samexporter icon indicating copy to clipboard operation
samexporter copied to clipboard

Encoder only exports for vit_h

Open steven-cerebralfix opened this issue 2 years ago • 1 comments

Great job on this, exactly what I was looking for!

However, when I attempt to export the encoder using:

python -m samexporter.export_encoder --checkpoint original_models/sam_vit_l_0b3195.pth --output output_models/sam_vit_l_0b3195.encoder/model.onnx --model-type vit_l --quantize-out output_models/sam_vit_l_0b3195.encoder.quant.onnx --use-preprocess

python -m samexporter.export_encoder --checkpoint original_models/sam_vit_b_01ec64.pth --output output_models/sam_vit_b_01ec64.encoder/model.onnx --model-type vit_b --quantize-out output_models/sam_vit_b_01ec64.encoder.quant.onnx --use-preprocess

Error Output: Loading model... Exporting onnx model to output_models/sam_vit_l_0b3195.encoder/model.onnx... Traceback (most recent call last): File "C:\ProgramData\Anaconda3\lib\runpy.py", line 197, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\ProgramData\Anaconda3\lib\runpy.py", line 87, in _run_code exec(code, run_globals) File "C:\Work\AR\samexporter\samexporter\export_encoder.py", line 178, in run_export( File "C:\Work\AR\samexporter\samexporter\export_encoder.py", line 157, in run_export with open(output, "wb") as f: FileNotFoundError: [Errno 2] No such file or directory: 'output_models/sam_vit_l_0b3195.encoder/model.onnx'

I see the flag on export_encoder.py, but I'm not sure how this should look for vit_l and vit_b?

Thanks, Steven.

steven-cerebralfix avatar May 15 '23 05:05 steven-cerebralfix

@steven-cerebralfix does this output_models/sam_vit_l_0b3195.encoder/ directory exist? It might be that you're just providing a path that doesn't exist, thus the exception. I had no problems exporting the vit_b encoder

cile98 avatar Jun 12 '24 07:06 cile98