Downloads · 30 days
18
4% of all-time downloads
casperhansen/mpt-7b-8k-chat-gptq
mpt-7b-8k-chat-gptq is a text generation model from casperhansen. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as cc-by-nc-sa-4.0.
License: CC-By-NC-SA-4.0 (non-commercial use only)
Downloads · 30 days
18
4% of all-time downloads
All-time downloads
507
Public
Repo size
3.8 GB
Likes
2
Public
Click a slice to open those files.
.bin3.8 GB · 100%
From the Hugging Face model README
License: CC-By-NC-SA-4.0 (non-commercial use only)
You need auto-gptq installed to run the following: pip install auto-gptq
Example script:
from auto_gptq import AutoGPTQForCausalLM
from transformers import AutoTokenizer, TextGenerationPipeline, TextStreamer
quantized_model = "casperhansen/mpt-7b-8k-chat-gptq"
print('loading model...')
# load quantized model to the first GPU
tokenizer = AutoTokenizer.from_pretrained(quantized_model, use_fast=True)
model = AutoGPTQForCausalLM.from_quantized(quantized_model, device="cuda:0", trust_remote_code=True)
prompt_format = """<|im_start|>system
A conversation between a user and an LLM-based AI assistant. The assistant gives helpful and honest answers.<|im_end|>
<|im_start|>user
{text}<|im_end|>
<|im_start|>assistant
"""
prompt = prompt_format.format(text="What is the difference between nuclear fusion and fission?")
print('generating...')
# or you can also use pipeline
streamer = TextStreamer(tokenizer, skip_special_tokens=True)
tokens = tokenizer(prompt, return_tensors="pt").to(model.device)
output = model.generate(**tokens, max_length=512, streamer=streamer, eos_token_id=tokenizer.eos_token_id)