ORTModelForCausalLM loads a causal language model into ONNX Runtime format through Optimum, then can save and quantize it for CPU inference. section 7.2.1
It is chosen here because CodeGen is a causal LM, and the model is downloaded from the Hugging Face Hub with an execution provider set at load time. section 7.2.1
Typical workflow in this material:
- Export a supported causal LM to ONNX with a provider such as CPUExecutionProvider. section 7.2.1
- Run text generation through a Transformers pipeline and benchmark latency and throughput. section 7.2.1
CodeGen 350M mono on CPU
The example loads Salesforce/codegen-350M-mono as an ORTModelForCausalLM with export=True and provider="CPUExecutionProvider", then saves and quantizes it.
