OnnxLLM: A collection of Onnx Large Language Models.
Project description
OnnxLLM
This is an example project for learning purpose
Installation
Using Prebuilt
pip install onnxllm
Install From Source
pip install git+https://github.com/inisis/OnnxLLM@main
Install From Local
git clone https://github.com/inisis/OnnxLLM && cd OnnxLLM/
pip install .
How to use
from transformers import AutoTokenizer
from onnxllm import AutoModelForCausalLM
# you should download onnx models from https://huggingface.co/inisis-me first
tokenizer = AutoTokenizer.from_pretrained("/data/llm/llm-export/onnx-standard/", trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained("/data/llm/llm-export/onnx-standard/", trust_remote_code=True)
prompt = '蒙古国的首都是乌兰巴托(Ulaanbaatar)\n冰岛的首都是雷克雅未克(Reykjavik)\n埃塞俄比亚的首都是'
inputs = tokenizer(prompt, return_tensors='pt')
output = model.generate(**inputs, max_new_tokens=50)
print(tokenizer.decode(output[0], skip_special_tokens=True))
References
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
onnxllm-0.0.1.tar.gz
(9.3 kB
view details)
Built Distribution
onnxllm-0.0.1-py3-none-any.whl
(12.6 kB
view details)
File details
Details for the file onnxllm-0.0.1.tar.gz
.
File metadata
- Download URL: onnxllm-0.0.1.tar.gz
- Upload date:
- Size: 9.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b158c2c9fbc496517e9ca12bac8813267165bcf593f1d0de1ac12bd61b2f3a3e |
|
MD5 | 20a9a3ce0b69a15edae0ab8d64db18dd |
|
BLAKE2b-256 | b9228d4c638ada20206f7bf3c0772d0ae704123189244ac45e22080b5f040a38 |
File details
Details for the file onnxllm-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: onnxllm-0.0.1-py3-none-any.whl
- Upload date:
- Size: 12.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 68fce3a120448b059dade4e57b149026156b99932d8c8f77114f79ad0644e759 |
|
MD5 | 12604191324211905ac4fd45ca559a0b |
|
BLAKE2b-256 | ed0eabfda5b08b0d2d897258608b54aed13ef8c8af9c7c5e7daec9de9fa87162 |