Downloads · 30 days
9
11% of all-time downloads
sandeepsundaram/phi2-ultrachat-qlora
phi2-ultrachat-qlora is a text generation model from sandeepsundaram. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as mit.
phi2-ultrachat-qlora is a Transformer fine tuned using the ultrachat dataset.
Downloads · 30 days
9
11% of all-time downloads
All-time downloads
79
Public
Parameters
2.8B
5.6 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors5.6 GB · 100%
From the Hugging Face model README
phi2-ultrachat-qlora is a Transformer fine tuned using the ultrachat dataset.
Our model hasn't been fine-tuned through reinforcement learning from human feedback. The intention behind crafting this open-source model is to provide the research community with a non-restricted small model to explore vital safety challenges, such as reducing toxicity, understanding societal biases, enhancing controllability, and more.
import warnings
from transformers import AutoModelForCausalLM, AutoTokenizer
path= f"sandeepsundaram/phi2-ultrachat-qlora"
tokenizer = AutoTokenizer.from_pretrained(path)
tokenizer.eos_token_id = model.config.eos_token_id
tokenizer.pad_token = tokenizer.eos_token
tokenizer.add_special_tokens({'pad_token': '[PAD]'})
warnings.filterwarnings('ignore') # Ignore all warnings
#inputs = tokenizer('Question: why human are cute then human? write in the form of poem. \n Output: ', return_tensors="pt", return_attention_mask=False).to('cuda')
inputs = tokenizer('''write code for fibonaci series in python.''', return_tensors="pt", return_attention_mask=False).to('cuda')
generation_params = {
'max_length': 512,
'do_sample': True,
'temperature': .5,
'top_p': 0.9,
'top_k': 50
}
outputs = model.generate(**inputs, **generation_params)
decoded_outputs = tokenizer.batch_decode(outputs)
for text in decoded_outputs:
text = text.replace('\\n', '\n')
print(text)
print("\n\n")