g-ronimo commited on
Commit
50fa39a
·
1 Parent(s): d0ebde6

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +53 -0
README.md ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ ---
4
+
5
+ meta-llama/Llama-2-7b trained on ~350 episodes of the Lex Friedman podcast (Lex=Assistant), QLoRA, ChatML
6
+
7
+ ```
8
+ from transformers import AutoModelForCausalLM, AutoTokenizer
9
+ import torch
10
+
11
+ model_path="models/llama-friedman"
12
+
13
+ model = AutoModelForCausalLM.from_pretrained(
14
+ model_path,
15
+ torch_dtype=torch.bfloat16,
16
+ )
17
+ tokenizer = AutoTokenizer.from_pretrained(model_path, use_fast=True, legacy=False) # fast tokenizer
18
+
19
+ # sampling parameters: llama-precise
20
+ gen_config = {
21
+ "temperature": 0.7,
22
+ "top_p": 0.1,
23
+ "repetition_penalty": 1.18,
24
+ "top_k": 40,
25
+ "do_sample": True,
26
+ "max_new_tokens": 300,
27
+ }
28
+
29
+ messages = [
30
+ {"role": "user", "content": "Good morning, I am Mark Zuckerberg"},
31
+ {"role": "assistant", "content": "The founder of Meta"},
32
+ {"role": "user", "content": "Yes exactly! And the future of AI"}
33
+ ]
34
+
35
+ prompt=tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
36
+ prompt_tokenized=tokenizer(prompt, return_tensors="pt", add_special_tokens=False).to("cuda")
37
+
38
+ output_ids = model.generate(**prompt_tokenized, **gen_config)
39
+ response=tokenizer.decode(output_ids[0])
40
+
41
+ print(response)
42
+ ```
43
+
44
+ ```
45
+ |im_start|>user
46
+ Good morning, I am Mark Zuckerberg<|im_end|>
47
+ <|im_start|>assistant
48
+ The founder of Meta<|im_end|>
49
+ <|im_start|>user
50
+ Yes exactly! And the future of AI<|im_end|>
51
+ <|im_start|>assistant
52
+ Today we are here to talk about the metaverse. What is it? How do you see it evolving in the next decades? Let's start with some basics. What is the metaverse?<|im_end|>
53
+ ```