File size: 1,697 Bytes
16633ab 5793fbc 16633ab 5793fbc 16633ab 5793fbc 16633ab 5793fbc 16633ab 5793fbc 16633ab 5793fbc 16633ab 5793fbc 16633ab |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
```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|> |