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

How to export decoder for mobile net model? #13

Open
kgeorge-fission opened this issue Feb 20, 2024 · 1 comment
Open

How to export decoder for mobile net model? #13

kgeorge-fission opened this issue Feb 20, 2024 · 1 comment

Comments

@kgeorge-fission
Copy link

I've exported a mobile net model using the export_encoder script using mobilenet weights for mobilenet model. Now how do I export decoder for this?
I cannot see a mobile type in export_decoder script, also should I pass the same mobile_sam.pt or vit_h.pth model as the check point for decoder?
Any help is appreciated.

@Tbolp
Copy link

Tbolp commented Aug 27, 2024

def run_export(
    model_type: str,
    checkpoint: str,
    output: str,
    use_preprocess: bool,
    opset: int,
    gelu_approximate: bool = False,
):
    print("Loading model...")
    if model_type == "mobile":
        checkpoint = torch.load(checkpoint, map_location="cpu")
        sam = setup_model()
        sam.load_state_dict(checkpoint, strict=True)
    else:
        sam = sam_model_registry[model_type](checkpoint=checkpoint)

I copied this code from export_encoder.py to export_decoder.py, and ran export_decoder.py with --model-type mobile successfully, but I did not check if the result is correct.

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