bpalacios commited on
Commit
811e5c7
·
verified ·
1 Parent(s): bb49f3e

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +42 -0
README.md CHANGED
@@ -11,6 +11,48 @@ tags:
11
 
12
 
13
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  ## Model Details
15
 
16
  ### Model Description
 
11
 
12
 
13
 
14
+
15
+ ```markdown
16
+
17
+ import torch
18
+ from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
19
+ from peft import PeftConfig, PeftModel
20
+ torch.random.manual_seed(0)
21
+ config = PeftConfig.from_pretrained("bpalacios/Phi-3-Finetuned")
22
+ model = AutoModelForCausalLM.from_pretrained(
23
+ "microsoft/Phi-3-mini-4k-instruct",
24
+ device_map="auto",
25
+ torch_dtype="auto",
26
+ trust_remote_code=True)
27
+ tokenizer = AutoTokenizer.from_pretrained("bpalacios/Phi-3-Finetuned")
28
+ model = PeftModel.from_pretrained(model, "bpalacios/Phi-3-Finetuned")
29
+ ```
30
+
31
+ ```markdown
32
+
33
+ model = AutoModelForCausalLM.from_pretrained(
34
+ "bpalacios/Phi-3-Finetuned",
35
+ device_map="auto",
36
+ torch_dtype="auto",
37
+ trust_remote_code=True)
38
+ tokenizer = AutoTokenizer.from_pretrained("bpalacios/Phi-3-Finetuned")
39
+
40
+ ```
41
+ ```markdown
42
+
43
+ pipe = pipeline(
44
+ "text-generation",
45
+ model=model,
46
+ tokenizer=tokenizer,
47
+ )
48
+
49
+ generation_args = {
50
+ "max_new_tokens": 500,
51
+ "return_full_text": False,
52
+ "temperature": 0.3,
53
+ "do_sample": False,
54
+ }
55
+ ```
56
  ## Model Details
57
 
58
  ### Model Description