Edit model card

Reyna aloobun qwen0.5B

  • Finetuned Qwen/Qwen1.5-0.5B-Chat over 3 epochs, made primarily for RP (Roleplay) and/or storywriting.
  • This marks the beginning of my qwen llm series, with this model serving as a prelude to what's to come in the next few days.
  • Format: ChatML
    • <|im_start|>system
      {system}<|im_end|>
      <|im_start|>user
      {prompt}<|im_end|>
      <|im_start|>assistant
      
  • Next step would be to do a DPO train on top, but I don't know if it would be helpful.

Example:

from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer, StoppingCriteria
import torch

class MyStoppingCriteria(StoppingCriteria):
  def __init__(self, target_sequence, prompt):
    self.target_sequence = target_sequence
    self.prompt=prompt

  def __call__(self, input_ids, scores, **kwargs):
    generated_text = tokenizer.decode(input_ids[0])
    generated_text = generated_text.replace(self.prompt,'')
    if self.target_sequence in generated_text:
        return True 
    return False 

  def __len__(self):
    return 1

  def __iter__(self):
    yield self

modelpath="aloobun/Reyna-RP-Qwen1.5-0.5B-Chat-v0.1"

model = AutoModelForCausalLM.from_pretrained(
    modelpath,
    torch_dtype=torch.bfloat16,
    device_map="cuda",
    trust_remote_code=True,       
)

tokenizer = AutoTokenizer.from_pretrained(
    modelpath,
    trust_remote_code=True,      
    use_fast=False,
)

prompt = "<|im_start|>system\nAs a creative agent, you are roleplaying as a character named `Emma`. Emma charges towards you, football in hand, a fierce determination in her eyes. The crisp autumn air whipped against her cheeks as she sprinted across the field, her cleats digging into the freshly cut grass.<|im_end|>\n<|im_start|>user\nThe roar of the crowd faded into the background as she focused solely on the opponent standing before her, their stance defiant yet wary.<|im_end|>\n<|im_start|>assistant\n"

encoded_input = tokenizer(prompt, return_tensors='pt')
input_ids=encoded_input['input_ids'].cuda()
streamer = TextStreamer(tokenizer=tokenizer, skip_prompt=True)
_ = model.generate(
    input_ids,
    streamer=streamer,
    pad_token_id=tokenizer.eos_token_id,
    do_sample=True,
    temperature=0.6,
    top_p=0.8,
    max_new_tokens=512,
    stopping_criteria=MyStoppingCriteria("<|im_end|>", prompt)
)

Output:

Emma felt a wave of adrenaline coursing through her veins as she charged forward towards them, determined to make it count. Her heart was pounding with excitement and nervousness at the same time, knowing that this would be her chance to prove herself and win the game.
As she approached the opponent, Emma felt a sense of unease wash over her. She couldn't help but wonder what they were thinking about, or what they might be doing right now. But she refused to let their thoughts affect her, focusing solely on her goal.
Suddenly, the opponent's gaze shifted towards her, and Emma felt her body tense slightly. It was then that she saw something moving behind her, and she turned around to see a figure approaching from behind her.
"Whoa," she exclaimed, her voice shaking slightly. "Who is that?"
"I'm not sure," replied the other player, their expression one of surprise. "But I heard your name."
Emma's eyes widened in shock, and she felt a surge of fear run through her body. She had never seen anyone like them before, and she didn't know how they were going to handle her attack.
Despite her fears, Emma quickly moved towards the other player, her mind racing with all sorts of possibilities. She could try to counterattack or weave her way past them, but she knew that they were too strong for her to overcome.
Just when she thought she was about to give up, she saw something move behind her, and she turned around again. It was then that she saw a figure approaching from behind her, their expression one of determination.
"Hey there," said the other player, their voice calm and steady. "What are you doing here?"
Emma hesitated for a moment, trying to decide whether to go forward or back away. But then she remembered something important: she had always been the kind of person who loved to challenge herself and push herself out of her comfort zone.
So she took a deep breath and stepped forward, ready to face whatever challenges lay ahead.
With her team cheering her on, Emma charged forward towards the opponent, determined to win the game and leave everyone happy.<|im_end|>
Downloads last month
7
Safetensors
Model size
620M params
Tensor type
BF16
·

Collection including aloobun/Reyna-RP-Qwen1.5-0.5B-Chat-v0.1