Downloads · 30 days
148
8% of all-time downloads
RichardErkhov/DavidLanz_-_Taiwan-tinyllama-v1.0-chat-gguf
DavidLanz_-_Taiwan-tinyllama-v1.0-chat-gguf is a machine learning model from RichardErkhov. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
Downloads · 30 days
148
8% of all-time downloads
All-time downloads
1.9K
Public
Repo size
12.7 GB
Likes
0
Public
Click a slice to open those files.
.gguf14.7 GB · 100%
From the Hugging Face model README
Quantization made by Richard Erkhov.
Taiwan-tinyllama-v1.0-chat - GGUF
library_name: transformers license: apache-2.0 datasets:
This is a continue-pretrained version of Tinyllama tailored for traditional Chinese. The continue-pretraining dataset contains roughly 2B tokens.
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
def generate_response(input):
'''
simple test for the model
'''
# tokenzize the input
tokenized_input = tokenizer.encode_plus(input, return_tensors='pt').to(device)
# generate the response
outputs = model.generate(
input_ids=tokenized_input['input_ids'],
attention_mask=tokenized_input['attention_mask'],
pad_token_id=tokenizer.pad_token_id,
do_sample=False,
repetition_penalty=1.3,
max_length=500
)
# decode the response
return tokenizer.decode(outputs[0], skip_special_tokens=True)
if __name__ == '__main__':
device = 'cuda' if torch.cuda.is_available() else 'cpu'
model = AutoModelForCausalLM.from_pretrained("DavidLanz/Taiwan-tinyllama-v1.0-chat",device_map=device,torch_dtype=torch.bfloat16)
tokenizer = AutoTokenizer.from_pretrained("DavidLanz/Taiwan-tinyllama-v1.0-chat")
while(True):
text = input("input a simple prompt:")
print('System:', generate_response(text))
Using bfloat16, the VRAM required is around 3GB!!!