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

Instantiating a model with an InferenceSession yields error in inference #149

Open
ir2718 opened this issue Feb 27, 2025 · 0 comments
Open

Comments

@ir2718
Copy link

ir2718 commented Feb 27, 2025

Hi,

As the title suggests, I tried instantiating an SaT model with an already downloaded ONNX model as I'm interested in using it in offline mode. This works, but doing inference with the split method will raise an error:

        def get_default_threshold(model_str: str):
            if "sm" in model_str:
                return 0.25
            if self.use_lora:
                return 0.5
            if "no-limited-lookahead" in model_str and "sm" not in model_str:
                return 0.01
            return 0.025

        default_threshold = get_default_threshold(self.model_name_or_model)
  File "myvenv/lib/python3.11/site-packages/wtpsplit/__init__.py", line 804, in _split
    default_threshold = get_default_threshold(self.model_name_or_model)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "myvenv/lib/python3.11/site-packages/wtpsplit/__init__.py", line 796, in get_default_threshold
    if "sm" in model_str:
       ^^^^^^^^^^^^^^^^^
TypeError: argument of type 'InferenceSession' is not iterable

I presume the get_default_threshold method expects a string, however this is currently not supported.

I've managed to get it working by cloning the repository from the HuggingFace hub. If this is the intended way of using models in offline mode, please briefly describe it in the documentation.

Thanks for the great work!

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

1 participant