Downloads · 30 days
0
remzicam/xs_blenderbot_onnx
xs_blenderbot_onnx is a machine learning model from remzicam. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as other.
onnx quantized version of facebook/blenderbotsmall-90M model (350 mb)
Downloads · 30 days
0
Access
Public
Updated Dec 26, 2022
Repo size
168 MB
Likes
1
Public
Click a slice to open those files.
.onnx168 MB · 100%
From the Hugging Face model README
onnx quantized version of facebook/blenderbot_small-90M model (350 mb)
Faster cpu inference
Before usage:
• download blender_model.py script from files in this repo
• pip install onnxruntime
you can use the model with huggingface generate function with its all parameters
With text generation pipeline
>>>from blender_model import TextGenerationPipeline
>>>max_answer_length = 100
>>>response_generator_pipe = TextGenerationPipeline(max_length=max_answer_length)
>>>utterance = "Hello, how are you?"
>>>response_generator_pipe(utterance)
i am well. how are you? what do you like to do in your free time?
Or you can call the model
>>>from blender_model import OnnxBlender
>>>from transformers import BlenderbotSmallTokenizer
>>>original_repo_id = "facebook/blenderbot_small-90M"
>>>repo_id = "remzicam/xs_blenderbot_onnx"
>>>model_file_names = [
"blenderbot_small-90M-encoder-quantized.onnx",
"blenderbot_small-90M-decoder-quantized.onnx",
"blenderbot_small-90M-init-decoder-quantized.onnx",
]
>>>model=OnnxBlender(original_repo_id, repo_id, model_file_names)
>>>utterance = "Hello, how are you?"
>>>inputs = tokenizer(utterance,
return_tensors="pt")
>>>outputs= model.generate(**inputs,
max_length=max_answer_length)
>>>response = tokenizer.decode(outputs[0],
skip_special_tokens = True)
>>>print(response)
i am well. how are you? what do you like to do in your free time?
To create the model, I adopted codes from https://github.com/siddharth-sharma7/fast-Bart repository.