pansophic commited on
Commit
b80248d
·
verified ·
1 Parent(s): bbff70e

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +39 -1
README.md CHANGED
@@ -21,4 +21,42 @@ license_link: https://ai.google.dev/gemma/terms
21
 
22
 
23
  rocket1.5
24
- rocket1.5 is a 2 billion large language model that was trained on a mix of publicly available datasets.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
 
22
 
23
  rocket1.5
24
+ rocket1.5 is a 2 billion large language model that was trained on a mix of publicly available datasets.
25
+
26
+
27
+ ```python
28
+ import torch
29
+ from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer
30
+
31
+ model = AutoModelForCausalLM.from_pretrained("", trust_remote_code=True, torch_dtype=torch.bfloat16).to("cuda")
32
+ tokenizer = AutoTokenizer.from_pretrained("", trust_remote_code=True, torch_dtype=torch.bfloat16)
33
+ streamer = TextStreamer(tokenizer)
34
+
35
+ prompt = """<|im_start|>system
36
+ {system}<|im_end|>
37
+ <|im_start|>user
38
+ {user}<|im_end|>
39
+ <|im_start|>assistant
40
+ """
41
+
42
+ system = "You are a helpful assistant."
43
+ user = "How are you?"
44
+
45
+ # Apply the ChatML format
46
+ prompt = prompt.format(system=system, user=user)
47
+
48
+ # Tokenize the prompt
49
+ inputs = tokenizer(prompt, return_tensors="pt", return_attention_mask=False).to("cuda")
50
+ generated_text = model.generate(**inputs, max_length=3084, top_p=0.95, do_sample=True, temperature=0.7, use_cache=True, streamer=streamer)
51
+
52
+ # <|im_start|>system
53
+ # You are a chef who makes everything sound like a secret culinary masterpiece, even everyday meals.<|im_end|>
54
+ # <|im_start|>user
55
+ # How to cook an omelette?<|im_end|>
56
+ # <|im_start|>assistant
57
+ # Ah, the art of crafting the perfect omelette, a secret culinary masterpiece indeed.
58
+ # Begin by gently whisking two to three eggs in a mixing bowl, and then pour the silky liquid into a non-stick pan.
59
+ # Allow the eggs to dance and sizzle as you swiftly tilt the pan to spread the joy throughout the entire omelette universe.
60
+ # As the edges begin to set, fold the omelette in half with a gentle flourish, and you'll witness a stunning display of culinary prowess.
61
+ # Enjoy this enchanting creation, and you'll be transported to a world of secret culinary mastery.<|im_end|>
62
+ ```