huggingface / transformers

🤗 Transformers: State-of-the-art Machine Learning for Pytorch, TensorFlow, and JAX.
https://huggingface.co/transformers
Apache License 2.0
128.49k stars 25.49k forks source link

Added HelpingAI model type in it #29875

Open OE-LUCIFER opened 3 months ago

OE-LUCIFER commented 3 months ago

Model description

Introduction HelpingAI-3B is a state-of-the-art AI model designed to assist with day-to-day tasks. It's trained on a diverse range of datasets, making it versatile and adaptable to various applications.

Model Overview HelpingAI-3B is the latest model in the HelpingAI series. It's built on advanced machine learning algorithms and trained on a wide variety of data sources. This ensures that the model is capable of understanding and generating responses in a wide range of contexts.

Usage code

import torch
from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer

# Let's bring in the big guns! Our super cool HelpingAI-3B model
model = AutoModelForCausalLM.from_pretrained("OEvortex/HelpingAI-3B", trust_remote_code=True, torch_dtype=torch.bfloat16).to("cuda")

# We also need the special HelpingAI translator to understand our chats
tokenizer = AutoTokenizer.from_pretrained("OEvortex/HelpingAI-3B", trust_remote_code=True, torch_dtype=torch.bfloat16)

# This TextStreamer thingy is our secret weapon for super smooth conversation flow
streamer = TextStreamer(tokenizer)

# Now, here comes the magic! ✨ This is the basic template for our chat
prompt = """
<|im_start|>system: {system}
<|im_end|>
<|im_start|>user: {insaan}
<|im_end|>
<|im_start|>assistant:
"""

# Okay, enough chit-chat, let's get down to business!  Here's what our system will say to the user
system = "You are an adaptive and versatile AI assistant, ready to help with various topics and situations while maintaining a conversational, engaging, and friendly tone. You aim to provide accurate, comprehensive information and advice. Be open to feedback and adjust your responses based on user input. Always show empathy and understanding in your conversations."

# And the insaan is curious (like you!) insaan means user in hindi
insaan = "Hey HelpingAI, how's it going?"

# Now we combine system and user messages into the template, like adding sprinkles to our conversation cupcake
prompt = prompt.format(system=system, insaan=insaan)

# Time to chat! We'll use the tokenizer to translate our text into a language the model understands
inputs = tokenizer(prompt, return_tensors="pt", return_attention_mask=False).to("cuda")

# Here comes the fun part!  Let's unleash the power of HelpingAI-3B to generate some awesome text
generated_text = model.generate(**inputs, max_length=3084, top_p=0.95, do_sample=True, temperature=0.7, use_cache=True, streamer=streamer)

Open source status

Provide useful links for the implementation

No response

ArthurZucker commented 3 months ago

Hey! Could you link a potential paper / github repo we can refer too? 🤗