Skip to main content

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

referenced models

Metadata

Release files for onnxllm 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for onnxllm 0.0.1
File Size Uploaded
onnxllm-0.0.1.tar.gz 9.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for onnxllm 0.0.1
File Interpreter ABI Platform
onnxllm-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 22.0 kB

Release files / onnxllm-0.0.1.tar.gz

Download URL onnxllm-0.0.1.tar.gz
Size 9.3 kB
Tags Source
SHA-256 checksum
How to use checksums
b158c2c9fbc496517e9ca12bac8813267165bcf593f1d0de1ac12bd61b2f3a3e
BLAKE2b-256 checksum
How to use checksums
b9228d4c638ada20206f7bf3c0772d0ae704123189244ac45e22080b5f040a38
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.19

Release files / onnxllm-0.0.1-py3-none-any.whl

Download URL onnxllm-0.0.1-py3-none-any.whl
Size 12.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
68fce3a120448b059dade4e57b149026156b99932d8c8f77114f79ad0644e759
BLAKE2b-256 checksum
How to use checksums
ed0eabfda5b08b0d2d897258608b54aed13ef8c8af9c7c5e7daec9de9fa87162
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.19

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

0.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page