Downloads · 30 days
20
6% of all-time downloads
gokaygokay/tiny_llama_chat_description_to_prompt
tiny_llama_chat_description_to_prompt is a text generation model from gokaygokay. Use it when you need the model to write or continue text. It is set up for transformers.
This model release is maintained by Gökay Aydoğan. If you reference this repository in academic work, please cite it as follows and also cite the upstream models, datasets, or projects it builds upon.
Downloads · 30 days
20
6% of all-time downloads
All-time downloads
341
Public
Parameters
1.1B
2.2 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors2.2 GB · 100%
From the Hugging Face model README
pip install -q -U transformers trl accelerate peft bitsandbytes
from transformers import AutoModelForCausalLM, GenerationConfig, AutoTokenizer
import torch
import os
model_id = "gokaygokay/tiny_llama_chat_description_to_prompt"
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.float16, load_in_8bit=False,
device_map="auto",
trust_remote_code=True)
tokenizer = AutoTokenizer.from_pretrained(model_id)
tokenizer.pad_token = tokenizer.eos_token
def generate_response(user_input):
prompt = f"<|im_start|>user\n{user_input}<|im_end|>\n<|im_start|>assistant:"
inputs = tokenizer([prompt], return_tensors="pt")
generation_config = GenerationConfig(penalty_alpha=0.6,do_sample = True,
top_k=5,temperature=0.9,repetition_penalty=1.2,
max_new_tokens=100,pad_token_id=tokenizer.eos_token_id
)
inputs = tokenizer(prompt, return_tensors="pt").to('cuda')
outputs = model.generate(**inputs, generation_config=generation_config)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
<!-- gokaygokay-citation -->
This model release is maintained by Gökay Aydoğan. If you reference this repository in academic work, please cite it as follows and also cite the upstream models, datasets, or projects it builds upon.
@software{aydogan2024tiny_llama_chat_description_to_prompt,
author = {Aydoğan, Gökay},
title = {{tiny_llama_chat_description_to_prompt}},
year = {2024},
publisher = {Hugging Face},
url = {https://huggingface.co/gokaygokay/tiny_llama_chat_description_to_prompt},
note = {Model repository; cite the base model and upstream datasets as required.}
}