-
Notifications
You must be signed in to change notification settings - Fork 120
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
OVModelForVisionCausalLM #883
Conversation
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. |
0aaf5f8
to
6276b0c
Compare
@echarlaix could you please take a look? Thanks! P.S. I'm still working on extending models coverage, but I think it makes sense to start looking on general API now |
de05b12
to
60ecb78
Compare
c35d1f2
to
e0da998
Compare
109f927
to
2fb59ce
Compare
96d8de4
to
57d209f
Compare
**kwargs, | ||
): | ||
""" | ||
Export a vanilla Transformers model into an ONNX model using `transformers.onnx.export_onnx`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really export to the ONNX? The docstrings should be revised accordingly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I accidentally copied that from https://github.com/huggingface/optimum-intel/blob/main/optimum/intel/openvino/modeling_base.py#L534
I see the same doc string in other model classes for openvino (seq2seq, stable diffusion support e.t.c.), @echarlaix maybe it is time to revise them in all models too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good, thanks a lot @eaidova
if model_type == "internvl-chat" and preprocessors is not None: | ||
model.config.img_context_token_id = preprocessors[0].convert_tokens_to_ids("<IMG_CONTEXT>") | ||
|
||
if hasattr(model, "image_newline"): | ||
model.config.image_newline = model.image_newline.tolist() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this needed ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is tranable parameter filled by random values during model weights init, we can not capture this during model export as it is not a part of submodels inference forward pass, that is why for transferring it from pt to ov I need to use config for that. If you have better suggestion, I can try to implement this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huge work, thanks @eaidova, left couple of minor comments
1164b36
to
a97f962
Compare
a97f962
to
e7295b7
Compare
Very nice, let's merge this PR and we can always extend support in following PRs, does it work for you @eaidova ? |
@echarlaix , yes, I agree, could you please merge? |
What does this PR do?
Enables conversion and inference for multimodality llm like llava, llava-next, falcon-vl, pixtral, internvl
Example of usage:
Before submitting