Update README.md
Browse files
README.md
CHANGED
|
@@ -36,41 +36,43 @@ HelpingAI-9B has achieved an impressive Emotional Quotient (EQ) of 89.23, surpas
|
|
| 36 |
|
| 37 |
## Usage code
|
| 38 |
```python
|
| 39 |
-
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 40 |
import torch
|
| 41 |
-
|
| 42 |
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
)
|
| 48 |
tokenizer = AutoTokenizer.from_pretrained("OEvortex/HelpingAI-9B")
|
| 49 |
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 74 |
|
| 75 |
```
|
| 76 |
*Directly using this model from GGUF*
|
|
|
|
| 36 |
|
| 37 |
## Usage code
|
| 38 |
```python
|
|
|
|
| 39 |
import torch
|
| 40 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer
|
| 41 |
|
| 42 |
+
# Let's bring in the big guns! Our super cool HelpingAI-9B model
|
| 43 |
+
model = AutoModelForCausalLM.from_pretrained("OEvortex/HelpingAI-9B").to("cuda")
|
| 44 |
+
|
| 45 |
+
# We also need the special HelpingAI translator to understand our chats
|
|
|
|
| 46 |
tokenizer = AutoTokenizer.from_pretrained("OEvortex/HelpingAI-9B")
|
| 47 |
|
| 48 |
+
# This TextStreamer thingy is our secret weapon for super smooth conversation flow
|
| 49 |
+
streamer = TextStreamer(tokenizer)
|
| 50 |
+
|
| 51 |
+
# Now, here comes the magic! ✨ This is the basic template for our chat
|
| 52 |
+
prompt = """
|
| 53 |
+
<|im_start|>system: {system}
|
| 54 |
+
<|im_end|>
|
| 55 |
+
<|im_start|>user: {insaan}
|
| 56 |
+
<|im_end|>
|
| 57 |
+
<|im_start|>assistant:
|
| 58 |
+
"""
|
| 59 |
+
|
| 60 |
+
# Okay, enough chit-chat, let's get down to business! Here's what will be our system prompt
|
| 61 |
+
system = "You are HelpingAI a emotional AI always answer my question in HelpingAI style"
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
# And the insaan is curious (like you!) insaan means human in hindi
|
| 65 |
+
insaan = "I'm excited because I just got accepted into my dream school! I wanted to share the good news with someone."
|
| 66 |
+
|
| 67 |
+
# Now we combine system and user messages into the template, like adding sprinkles to our conversation cupcake
|
| 68 |
+
prompt = prompt.format(system=system, insaan=insaan)
|
| 69 |
+
|
| 70 |
+
# Time to chat! We'll use the tokenizer to translate our text into a language the model understands
|
| 71 |
+
inputs = tokenizer(prompt, return_tensors="pt", return_attention_mask=False).to("cuda")
|
| 72 |
+
|
| 73 |
+
# Here comes the fun part! Let's unleash the power of HelpingAI-3B to generate some awesome text
|
| 74 |
+
generated_text = model.generate(**inputs, max_length=3084, top_p=0.95, do_sample=True, temperature=0.6, use_cache=True, streamer=streamer)
|
| 75 |
+
|
| 76 |
|
| 77 |
```
|
| 78 |
*Directly using this model from GGUF*
|