Abhaykoul commited on
Commit
b75e3bf
1 Parent(s): e4fcdd8

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +40 -0
README.md CHANGED
@@ -36,3 +36,43 @@ The performance of HelpingAI-3B is compared with other relevant models on variou
36
  | 3BigReasonCinder | 48.16 | 41.72 | 65.16 | 44.79 | 44.76 | 64.96 | 27.6 |
37
  | MintMerlin-3B | 47.63 | 44.37 | 66.56 | 43.21 | 47.07 | 64.4 | 20.17 |
38
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  | 3BigReasonCinder | 48.16 | 41.72 | 65.16 | 44.79 | 44.76 | 64.96 | 27.6 |
37
  | MintMerlin-3B | 47.63 | 44.37 | 66.56 | 43.21 | 47.07 | 64.4 | 20.17 |
38
 
39
+ ## Simple Usage Code
40
+ ```python
41
+ import torch
42
+ from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer
43
+
44
+ # Let's bring in the big guns! Our super cool HelpingAI-3B model
45
+ model = AutoModelForCausalLM.from_pretrained("OEvortex/HelpingAI-3B", trust_remote_code=True, torch_dtype=torch.bfloat16).to("cuda")
46
+
47
+ # We also need the special HelpingAI translator to understand our chats
48
+ tokenizer = AutoTokenizer.from_pretrained("OEvortex/HelpingAI-3B", trust_remote_code=True, torch_dtype=torch.bfloat16)
49
+
50
+ # This TextStreamer thingy is our secret weapon for super smooth conversation flow
51
+ streamer = TextStreamer(tokenizer)
52
+
53
+ # Now, here comes the magic! ✨ This is the basic template for our chat
54
+ prompt = """
55
+ <|im_start|>system: {system}
56
+ <|im_end|>
57
+ <|im_start|>user: {insaan}
58
+ <|im_end|>
59
+ <|im_start|>assistant:
60
+ """
61
+
62
+ # Okay, enough chit-chat, let's get down to business! Here's what our system will say to the user
63
+ 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."
64
+
65
+
66
+ # And the insaan is curious (like you!) insaan means user in hindi
67
+ insaan = "Hey HelpingAI, how's it going?"
68
+
69
+ # Now we combine system and user messages into the template, like adding sprinkles to our conversation cupcake
70
+ prompt = prompt.format(system=system, user=user)
71
+
72
+ # Time to chat! We'll use the tokenizer to translate our text into a language the model understands
73
+ inputs = tokenizer(prompt, return_tensors="pt", return_attention_mask=False).to("cuda")
74
+
75
+ # Here comes the fun part! Let's unleash the power of HelpingAI-3B to generate some awesome text
76
+ generated_text = model.generate(**inputs, max_length=3084, top_p=0.95, do_sample=True, temperature=0.7, use_cache=True, streamer=streamer)
77
+ ```
78
+