macadeliccc commited on
Commit
cc2c71e
β€’
1 Parent(s): 43bf26f

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +21 -4
README.md CHANGED
@@ -7,16 +7,33 @@ Merge of two Solar-10.7B instruct finetunes.
7
 
8
  ![solar](solar.png)
9
 
10
- ## 🌟 Usage
11
-
12
 
13
  ## πŸŒ… Code Example
14
 
15
- TODO
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
 
17
  ## Evaluations
18
 
19
- model is currently experimental
20
 
21
  | Tasks |Version|Filter|n-shot| Metric |Value | |Stderr|
22
  |-------------|-------|------|-----:|--------|-----:|---|-----:|
 
7
 
8
  ![solar](solar.png)
9
 
 
 
10
 
11
  ## πŸŒ… Code Example
12
 
13
+ ```python
14
+ import torch
15
+ from transformers import AutoModelForCausalLM, AutoTokenizer
16
+
17
+ tokenizer = AutoTokenizer.from_pretrained("macadeliccc/SOLAR-math-2x10.7b",load_in_4bit=True)
18
+ model = AutoModelForCausalLM.from_pretrained(
19
+ "macadeliccc/SOLAR-math-2x10.7b",
20
+ device_map="auto",
21
+ torch_dtype=torch.float16,
22
+ )
23
+
24
+ conversation = [ {'role': 'user', 'content': 'A rectangle has a length that is twice its width and its area is 50 square meters. Find the dimensions of the rectangle.'} ]
25
+
26
+ prompt = tokenizer.apply_chat_template(conversation, tokenize=False, add_generation_prompt=True)
27
+
28
+ inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
29
+ outputs = model.generate(**inputs, use_cache=True, max_length=4096)
30
+ output_text = tokenizer.decode(outputs[0])
31
+ print(output_text)
32
+ ```
33
 
34
  ## Evaluations
35
 
36
+ model is currently experimental and was evaluated in 4-bit
37
 
38
  | Tasks |Version|Filter|n-shot| Metric |Value | |Stderr|
39
  |-------------|-------|------|-----:|--------|-----:|---|-----:|