Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Encoder only exports for vit_h #1

Open
steven-cerebralfix opened this issue May 15, 2023 · 1 comment
Open

Encoder only exports for vit_h #1

steven-cerebralfix opened this issue May 15, 2023 · 1 comment

Comments

@steven-cerebralfix
Copy link

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.

@cile98
Copy link

cile98 commented Jun 12, 2024

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants