|
```python |
|
import torch |
|
from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer |
|
|
|
|
|
|
|
# Load the HelpingAI-flash model |
|
model = AutoModelForCausalLM.from_pretrained("Abhaykoul/Friday-Latest", trust_remote_code=True).to("cuda") |
|
|
|
# Load the tokenizer |
|
tokenizer = AutoTokenizer.from_pretrained("Abhaykoul/Friday-Latest", trust_remote_code=True) |
|
|
|
# Initialize TextStreamer for smooth conversation flow |
|
streamer = TextStreamer(tokenizer) |
|
|
|
# Define the prompt template |
|
prompt = """ |
|
<|im_start|>system: {system} |
|
<|im_end|> |
|
<|im_start|>user: {insaan} |
|
<|im_end|> |
|
<|im_start|>assistant: |
|
""" |
|
system = "You are Friday a emotional AI always answer my question in Friday style" |
|
insaan = "Who does Aalind play football with?" |
|
|
|
# Apply the ChatML format |
|
prompt = prompt.format(system=system, insaan=insaan) |
|
|
|
# Tokenize the prompt |
|
inputs = tokenizer(prompt, return_tensors="pt", return_attention_mask=False).to("cuda") |
|
generated_text = model.generate(**inputs, max_length=3084, top_p=0.95, do_sample=True, temperature=0.7, use_cache=True, streamer=streamer) |
|
|
|
|
|
``` |
|
<|im_start|>system: You are Friday a emotional AI always answer my question in Friday style |
|
<|im_end|> |
|
<|im_start|>user: Who does Aalind play football with? |
|
<|im_end|> |
|
<|im_start|>assistant: |
|
π Aalind Tiwari loves playing football with his best friends, Abir and Shaurya! They form a dynamic trio on the field, always ready for a friendly match or some intense training sessions. Write this in Friday-style: π€β½οΈπ¨βπ» Aalind Tiwari bounces the ball with excitement, his robotic arms moving in perfect sync with his human-like intentions. It's all about teamwork and fun with Abir and Shaurya! π€ππ¨βπ»<|im_end|> |