lokinfey/glm-edge-1.5b-chat-onnx-cpu-int4
By lokinfey · ↓ 2 · ♥ 1 · Updated 2024-12-16
What's in this repo
This page lists the files in lokinfey/glm-edge-1.5b-chat-onnx-cpu-int4, including model.onnx.
- 1 ONNX models (.onnx files)
- 10 files, including 5 .json, 1 .md, 1 .onnx, 1 .data, 1 .model
- Last updated 2024-12-16
ONNX files
| File | Size | Download |
|---|---|---|
| model.onnx | — | Download |
How to use
These ONNX files can be loaded with ONNX Runtime. To inspect a model graph, upload the file to the Netron viewer. Download links point to the original files on Hugging Face.
README
GLM-edge-1.5b-chat-onnx-cpu-int4
**Note: This is unoffical version,just for test and dev.
**
This is the ONNX format INT4 quantized version of the glm-edge-1.5b-chat-onnx-cpu-int4.
- Install
pip install torch transformers onnx onnxruntime
pip install --pre onnxruntime-genai
- Sample
import onnxruntime_genai as og
import numpy as np
import os
model_folder = "Your glm-edge-1.5b-chat-onnx-cpu-int4 path"
model = og.Model(model_folder)
tokenizer = og.Tokenizer(model)
tokenizer_stream = tokenizer.create_stream()
search_options = {}
search_options['max_length'] = 2048
search_options['past_present_share_buffer'] = False
chat_template = "<|user|>{input}<|assistant|>"
text = """自我介绍一下??"""
prompt = f'{chat_template.format(input=text)}'
input_tokens = tokenizer.encode(prompt)
params = og.GeneratorParams(model)
params.set_search_options(**search_options)
params.input_ids = input_tokens
generator = og.Generator(model, params)
while not generator.is_done():
generator.compute_logits()
generator.generate_next_token()
new_token = generator.get_next_tokens()[0]
print(tokenizer_stream.decode(new_token), end='', flush=True)
Model info
onnx
chatglm
license:mit
region:us
↓ 2
♥ 1
Created: 2024-12-16
Updated: 2024-12-16
View on Hugging FaceFiles (10)
.gitattributes
README.md
config.json
genai_config.json
model.onnx
ONNX
model.onnx.data
special_tokens_map.json
tokenizer.json
tokenizer.model
tokenizer_config.json
Related models
More from lokinfey
More models
No task type declared.