mmendoza commited on
Commit
9f489ff
·
1 Parent(s): f8a5bad

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +6 -0
README.md CHANGED
@@ -21,6 +21,7 @@ Output: I'm sorry, but I don't have any thoughts on the proposed merger and its
21
 
22
  ## Quick tutorial
23
 
 
24
  import torch
25
  from peft import PeftModel, PeftConfig
26
  from transformers import AutoModelForCausalLM, AutoTokenizer
@@ -29,11 +30,15 @@ peft_model_id = "mmendoza/gpt-j-6B-lora-polite-enh"
29
  config = PeftConfig.from_pretrained(peft_model_id)
30
  model = AutoModelForCausalLM.from_pretrained(config.base_model_name_or_path, return_dict=True, load_in_8bit=True, device_map='auto')
31
  tokenizer = AutoTokenizer.from_pretrained(config.base_model_name_or_path)
 
32
 
33
  # Load the Lora model
 
34
  model = PeftModel.from_pretrained(model, peft_model_id)
 
35
 
36
  # Prompting
 
37
  batch = tokenizer("You have an input text. Write a polite version of the text preserving the meaning of the input.
38
  Input: No card counting allowed in blackjack at the casino. Output: ", return_tensors='pt')
39
 
@@ -47,6 +52,7 @@ end = '.'
47
 
48
  line = line.replace("\n"," ")
49
  line = (line.split(start))[1].split(end)[0]
 
50
 
51
  "Please refrain from counting cards in blackjack at the casino."
52
 
 
21
 
22
  ## Quick tutorial
23
 
24
+ ```python
25
  import torch
26
  from peft import PeftModel, PeftConfig
27
  from transformers import AutoModelForCausalLM, AutoTokenizer
 
30
  config = PeftConfig.from_pretrained(peft_model_id)
31
  model = AutoModelForCausalLM.from_pretrained(config.base_model_name_or_path, return_dict=True, load_in_8bit=True, device_map='auto')
32
  tokenizer = AutoTokenizer.from_pretrained(config.base_model_name_or_path)
33
+ ```
34
 
35
  # Load the Lora model
36
+ ```python
37
  model = PeftModel.from_pretrained(model, peft_model_id)
38
+ ```
39
 
40
  # Prompting
41
+ ```python
42
  batch = tokenizer("You have an input text. Write a polite version of the text preserving the meaning of the input.
43
  Input: No card counting allowed in blackjack at the casino. Output: ", return_tensors='pt')
44
 
 
52
 
53
  line = line.replace("\n"," ")
54
  line = (line.split(start))[1].split(end)[0]
55
+ ```
56
 
57
  "Please refrain from counting cards in blackjack at the casino."
58