Add ONNX support for InternLM2#2244
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. |
| # TODO: fix "mpt" for which inference fails for transformers < v4.41 | ||
| if is_transformers_version(">=", "4.41"): | ||
| SUPPORTED_ARCHITECTURES.extend(["phi3", "mpt"]) | ||
| SUPPORTED_ARCHITECTURES.extend(["phi3", "mpt", "internlm2"]) |
There was a problem hiding this comment.
Could you add a test using a tiny random model like katuni4ka/tiny-random-internlm2 ?
You can add it in respectively PYTORCH_EXPORT_MODELS_TINY and MODEL_NAME
There was a problem hiding this comment.
Hi @echarlaix! Thanks a lot for your answer. I've added the tests in both PYTORCH_EXPORT_MODELS_TINY and MODEL_NAME.
There was a problem hiding this comment.
you will have to pass trust_remote_code=True for this model since huggingface/transformers#29667 was not merged
There was a problem hiding this comment.
I'm figuring out what the best way to pass the trust_remote_code = True parameter to main_export() is for the text_export.py and text_export_cli.py files, for instance. Are there any other models that require this to true? A shallow approach (later can be abstracted) would be to simply add e.g. here something like:
# Check for models that require remote code execution
if "internlm2" in model_name:
trust_remote_code = TrueSomething similar would apply for ORTModelForCausalLM in test_modeling.py.
Thanks a lot for your feedback @echarlaix @IlyasMoutawwakil!
There was a problem hiding this comment.
@gmf14 for now we don't support many (any ?) of remote code models (because they are usually hard to maintain).
let's simply use if model_type in ["internlm2"]: trust_remote_code = True in both export and modeling tests.
What does this PR do?
Adds support for ONNX export of InternLM2 model for text generation tasks (#2240).
Note: I checked the ONNX contribution guide and it seems I cannot find an updated version to add the tests, hence I haven't committed them yet. I would like to kindly ask what steps to take in order to add the tests correctly.
Before submitting
Who can review?
@fxmarty, @echarlaix, @JingyaHuang, @michaelbenayoun