Add ORTModel support for custom tasks#303
Conversation
|
The documentation is not available anymore as the PR was closed or merged. |
regisss
left a comment
There was a problem hiding this comment.
Thanks for this @JingyaHuang!!
Just one nit
philschmid
left a comment
There was a problem hiding this comment.
I am not sure if we should make this change for enabling something, which the classes aren't designed for.
You said
e.g. In ORTTrainer, the evaluation includes labels as input and loss as output. With the PR, it will enable us to replace bare inference sessions with ORTModels more easily.
This sounds more that we should use evaluate and pipeline or the ORTModel in the trainer with the post-processing outside of the model.
…gingface/optimum into jingya-refactoring-ort-model
|
I still do not understand the purpose of this change. As mentioned before the The changes you suggest:
The question I have is:
|
philschmid
left a comment
There was a problem hiding this comment.
can you add a test and then we should be good. Good idea! ✅ And if some use case emerges out of it we can add new task-specific model classes
Hi @philschmid, sorry for the late reply. I re-drafted the code, indeed it shouldn't be in other task-specific models as it will slow them down. The basic idea behind the PR is to leave some flexibility to users, it's like a fallback so that when they are using a more customized model they can still be able to benefit from the ORTModel foundation with a small sacrifice of speed. |
What does this PR do?
ORTModelForXXX.modeldecided valid inputs and outputs of the model's forward method, thus the creation of inputs in the forward method can be abstract, and also the outputs. This would allow the ORTModels to be more flexible.e.g. In
ORTTrainer, the evaluation includes labels as input and loss as output. With the PR, it will enable us to replace bare inference sessions with ORTModels more easily.Before submitting