Q4234 commited on
Commit
546312e
·
1 Parent(s): ea36a5b

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +27 -0
README.md CHANGED
@@ -1,5 +1,32 @@
1
  LoRA which is fine-tuned for "command" following.
2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  ### Prompting
4
 
5
  Assistant can use any tools he likes by calling the tool as python functions.
 
1
  LoRA which is fine-tuned for "command" following.
2
 
3
+ ### How to use?
4
+
5
+
6
+ import torch
7
+ from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
8
+
9
+ model_id = "EleutherAI/pythia-2.8b-deduped"
10
+
11
+ bnb_config = BitsAndBytesConfig(
12
+ load_in_4bit=True,
13
+ bnb_4bit_use_double_quant=True,
14
+ bnb_4bit_quant_type="nf4",
15
+ bnb_4bit_compute_dtype=torch.bfloat16
16
+ )
17
+
18
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
19
+ model = AutoModelForCausalLM.from_pretrained(model_id, quantization_config=bnb_config, device_map={"":0})
20
+
21
+ # load adapter
22
+ if True:
23
+ from peft import PeftModel
24
+ model = PeftModel.from_pretrained(
25
+ model, "Q4234/commandA-LoRA-2.8b",
26
+ torch_dtype=torch.float16
27
+ )
28
+
29
+
30
  ### Prompting
31
 
32
  Assistant can use any tools he likes by calling the tool as python functions.