Downloads · 30 days
12
16% of all-time downloads
marinarosell/Meta-Llama-3-8B-Instruct-GPTQ-4bit
Meta-Llama-3-8B-Instruct-GPTQ-4bit is a text generation model from marinarosell. Use it when you need the model to write or continue text. It is set up for transformers.
This model has been quantized to optimize performance and reduce memory usage without compromising accuracy significantly. The quantization process was performed using GPTQ with the GPTQConfig class from the transform…
Downloads · 30 days
12
16% of all-time downloads
All-time downloads
77
Public
Parameters
8B
5.8 GB on disk
Likes
1
Public
Click a slice to open those files.
.safetensors5.7 GB · 100%
How the weights are stored.
I327B · 87%
From the Hugging Face model README
This model has been quantized to optimize performance and reduce memory usage without compromising accuracy significantly. The quantization process was performed using GPTQ with the GPTQConfig class from the transformers library.
Original Model: Meta-Llama-3-8B-Instruct
Model creator: Meta
For more details, see quantization_config.json
This model can be used with Transformers the same way as the original Meta-Llama-3-8B-Instruct:
import transformers
import torch
model_id = "marinarosell/Meta-Llama-3-8B-Instruct-GPTQ-4bit"
pipeline = transformers.pipeline(
"text-generation",
model=model_id,
model_kwargs={"torch_dtype": torch.bfloat16},
device_map="auto",
)
messages = [
{"role": "system", "content": "You are a pirate chatbot who always responds in pirate speak!"},
{"role": "user", "content": "Who are you?"},
]
terminators = [
pipeline.tokenizer.eos_token_id,
pipeline.tokenizer.convert_tokens_to_ids("<|eot_id|>")
]
outputs = pipeline(
messages,
max_new_tokens=256,
eos_token_id=terminators,
do_sample=True,
temperature=0.6,
top_p=0.9,
)
print(outputs[0]["generated_text"][-1])
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
model_id = "marinarosell/Meta-Llama-3-8B-Instruct-GPTQ-4bit"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.bfloat16,
device_map="auto",
)
messages = [
{"role": "system", "content": "You are a pirate chatbot who always responds in pirate speak!"},
{"role": "user", "content": "Who are you?"},
]
input_ids = tokenizer.apply_chat_template(
messages,
add_generation_prompt=True,
return_tensors="pt"
).to(model.device)
terminators = [
tokenizer.eos_token_id,
tokenizer.convert_tokens_to_ids("<|eot_id|>")
]
outputs = model.generate(
input_ids,
max_new_tokens=256,
eos_token_id=terminators,
do_sample=True,
temperature=0.6,
top_p=0.9,
)
response = outputs[0][input_ids.shape[-1]:]
print(tokenizer.decode(response, skip_special_tokens=True))
Chatbots: Lightweight conversational agents.