lyraChatGLM / demo.py
vanewu's picture
NewAcceleration (#19)
78728a3
raw
history blame
715 Bytes
from lyraChatGLM import LyraChatGLM6B
model_path = "./models/1-gpu-fp16.h5"
tokenizer_path = "./models"
data_type = "fp16"
int8_mode = 0
max_output_length = 150
arch = "Ampere" # Ampere or Volta
model = LyraChatGLM6B(model_path, tokenizer_path, data_type, int8_mode, arch)
prompt = "今天天气大概 25度,有点小雨,吹着风,我想去户外散步,应该穿什么样的衣服裤子鞋子搭配。"
test_batch_size = 256
prompts = [prompt, ]
# If you want to get different output in same batch, you can set do_sample to True
output_texts = model.generate(prompts, output_length=max_output_length,top_k=30, top_p=0.85, temperature=0.35, repetition_penalty=1.2, do_sample=False)
print(output_texts)