-
Notifications
You must be signed in to change notification settings - Fork 123
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
[fix
] Extend when a model repository/directory already has an exported OV model
#1000
[fix
] Extend when a model repository/directory already has an exported OV model
#1000
Conversation
@tomaarsen thanks, changes looks good to me. Could you please provide test case for making sure that this behaviour will not break in future? |
Also will be helpful, if you can provide example of usage model with optimum-intel in this PR comment or description for such case If I right understand model initialization will require some additional parameters in this case? Even if there 2 models openvino_model.xml and openvino_model_int8_quant.xml, how we can make sure which of them will be loaded by default? |
Certainly, here is how you'd use it: model = OVModelForFeatureExtraction.from_pretrained(
"sentence-transformers/all-MiniLM-L6-v2",
export=False,
subfolder="openvino",
file_name="openvino_model_qint8_quantized.xml",
)
# tokenize, model forward, etc. as normal Indeed, both subfolder and file_name are required. and in Sentence Transformers: from sentence_transformers import SentenceTransformer
model = SentenceTransformer(
"sentence-transformers/all-MiniLM-L6-v2",
backend="openvino",
model_kwargs={"file_name": "openvino_model_qint8_quantized.xml"}, Hope that clears it up.
|
@tomaarsen thanks, I'm wondering will not usage of file_name (if provided) in file search be more robust in this case? there is only some nonverbal convention to start names with openvino, but on practice it is not obligated. Also do you not tried to use variant instead of file_name? |
@tomaarsen, can you please fix the test?
E AssertionError: False is not true |
@AlexKoff88 Done! Apologies, in my rush I forgot about adding the @eaidova It's possible that there's a better solution - I just went with one that was closest to the current implementation to avoid large changes while still fixing my issue.
|
@tomaarsen, can you please rebase to make the documentation build green as well? Thank you! |
…nto fix/extend_ov_matching
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
What does this PR do?
This PR extends when a model repository/directory already has an exported OV model.
This is required to load e.g.
openvino_model_qint8_quantized.xml
from https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2. The only reason that it's possible to load this model is because this repository also hasopenvino_model.xml
, so theexport
isn't forcibly set toTrue
.I didn't update any tests as it's a bit niche.
Before submitting
cc @l-bat @AlexKoff88 as you worked on the Sentence Transformers OV quantization function, which is affected by this issue.