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

ORTSeq2SeqTrainer refactoring - Inference with ORTModel #359

Merged

Conversation

JingyaHuang
Copy link
Collaborator

What does this PR do?

  • Enable ONNX Runtime inference in ORTSeq2SeqTrainer by leveraging subclasses of ORTModel for sequence to sequence tasks.

@JingyaHuang JingyaHuang changed the base branch from refactoring-orttrainer-inf to main August 24, 2022 08:35
@JingyaHuang JingyaHuang changed the base branch from main to refactoring-orttrainer-inf August 24, 2022 08:35
fxmarty and others added 13 commits August 24, 2022 12:12
* Refactorization of ORTOptimizer

* Refactorization of ORTModel

* Adapt examples according to refactorization

* Adapt tests

* Fix style

* Remove quantizer modification

* Fix style

* Apply modifications from #270 for quantizer and optimizer to have same behavior

* Add test for optimization of Seq2Seq models

* Fix style

* Add ort config saving when optimizing a model

* Add ort config saving when quantizing a model

* Add tests

* Fix style

* Adapt optimization examples

* Fix readme

* Remove unused parameter

* Adapt quantization examples

* Fix quantized model and ort config saving

* Add documentation

* Add model configuration saving to simplify loading of optimized model

* Fix style

* Fix description

* Fix quantization tests

* Remove opset argument which is onnx config default opset when exporting with ORTModels
* fix(optimization): handle empty file suffix

* fix(quantization): handle empty file suffix

* use pathlibfor save_dir

* run test again

* Update optimum/onnxruntime/quantization.py

Co-authored-by: Ella Charlaix <80481427+echarlaix@users.noreply.github.com>

* ReRun test that failed because of cache (network)

Co-authored-by: Ella Charlaix <80481427+echarlaix@users.noreply.github.com>
* fix class

* Update optimization.mdx
@JingyaHuang JingyaHuang marked this pull request as ready for review September 6, 2022 22:22
@JingyaHuang JingyaHuang merged commit 9a925c8 into refactoring-orttrainer-inf Sep 7, 2022
@JingyaHuang JingyaHuang deleted the refactoring-ort-seq2seqtrainer branch September 7, 2022 08:22
JingyaHuang added a commit that referenced this pull request Sep 19, 2022
…189)

* Inference with ORTModel

* Clean up unused imports

* Replace Inference session by ort model

* Inference with ORTModel

* Replace in evaluation_loop

* refactoring prediction_loop

* ORTSeq2SeqTrainer refactoring - Inference with ORTModel (#359)

* Override export of ORTSeq2SeqTrainer

* Update OnnxConfigWithLoss wrapper

* Fix ORTTrainer inference ort subclass parsing

* Override the evaluation and prediction loop in ORTSeq2SeqTrainer

* detect labels from input names

* Detect loss from output names

* Put back decoder with past

* Put past key values in the correct place

* remove if/else statement

* Revert the inference code
JingyaHuang added a commit that referenced this pull request Oct 2, 2022
* Inference with ORTModel

* Clean up unused imports

* Replace Inference session by ort model

* Inference with ORTModel

* Clean up unused imports

* Replace Inference session by ort model

* Update modeling for custom tasks

* Replace in evaluation_loop

* refectoring prediction_loop

* ORTSeq2SeqTrainer refactoring - Inference with ORTModel (#359)

* Override export of ORTSeq2SeqTrainer

* Do not force download by default in ORTModel (#356)

* Update OnnxConfigWithLoss wrapper

* ORT optimizer refactorization (#294)

* Refactorization of ORTOptimizer

* Refactorization of ORTModel

* Adapt examples according to refactorization

* Fix ORTTrainer inference ort subclass parsing

* Replace datasets.load_metric by evaluate

* Add summarization example

* Enable ORT inference

* Fix inference args

* Mention ORT inference in READMEs

* Remove repetitve code in Trainer

* Update examples to trfrs 4.22.1

* Fix qa example prediction error

* Update summarization/README.md

* Fix logger consistency

* Make readme consistent with trfrs

* Put back onnx config with past and loss test
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

Successfully merging this pull request may close these issues.

5 participants