diff options
| author | Jonas Knobloch <jonas.knobloch@t-online.de> | 2025-11-13 19:25:27 +0100 |
|---|---|---|
| committer | Jonas Knobloch <jonas.knobloch@t-online.de> | 2025-11-13 20:10:37 +0100 |
| commit | 019a25a6082a8cde372304e34dcd0ae3d5e875ed (patch) | |
| tree | 908157de7d20b67d8436a4fbed933c59f4a5d16e /gpt2/scripts | |
| parent | 148d5910f3577d7f8ed6aef57416a5f9d17efdc6 (diff) | |
Refactor into workspace
Diffstat (limited to 'gpt2/scripts')
| -rw-r--r-- | gpt2/scripts/conv.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/gpt2/scripts/conv.py b/gpt2/scripts/conv.py new file mode 100644 index 0000000..cf0cbb8 --- /dev/null +++ b/gpt2/scripts/conv.py @@ -0,0 +1,15 @@ +# /// script +# dependencies = [ +# "torch", +# "transformers", +# "optimum", +# "optimum[onnxruntime]", +# ] +# /// + +from transformers import AutoTokenizer, AutoModelForCausalLM +from optimum.onnxruntime import ORTModelForCausalLM + +model_id = "gpt2" +model = ORTModelForCausalLM.from_pretrained(model_id, export=True, use_cache=True) +model.save_pretrained("onnx-gpt2")
\ No newline at end of file |
