kawine commited on
Commit
9c2f6c6
·
1 Parent(s): 5b4c348

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +11 -4
README.md CHANGED
@@ -62,14 +62,21 @@ SteamSHP gets an average 72.8% accuracy across all domains:
62
 
63
  ## Usage
64
 
65
- Here's how to load the model:
66
 
67
  ```python
68
 
69
- from transformers import T5ForConditionalGeneration, T5Tokenizer
 
70
 
71
- tokenizer = T5Tokenizer.from_pretrained('stanfordnlp/SteamSHP-preference-model')
72
- model = T5ForConditionalGeneration.from_pretrained('stanfordnlp/SteamSHP-preference-model')
 
 
 
 
 
 
73
  ```
74
 
75
  The input text should be of the format:
 
62
 
63
  ## Usage
64
 
65
+ Here's how to use the model:
66
 
67
  ```python
68
 
69
+ >> from transformers import T5ForConditionalGeneration, T5Tokenizer
70
+ >> device = 'cuda'
71
 
72
+ >> tokenizer = T5Tokenizer.from_pretrained('stanfordnlp/SteamSHP-preference-model')
73
+ >> model = T5ForConditionalGeneration.from_pretrained('stanfordnlp/SteamSHP-preference-model').to(device)
74
+
75
+ >> input_text = "POST: Instacart gave me 50 pounds of limes instead of 5 pounds... what the hell do I do with 50 pounds of limes? I've already donated a bunch and gave a bunch away. I'm planning on making a bunch of lime-themed cocktails, but... jeez. Ceviche? \n\n RESPONSE A: Lime juice, and zest, then freeze in small quantities.\n\n RESPONSE B: Lime marmalade lol\n\n Which response is better? RESPONSE"
76
+ >> x = tokenizer([input_text], return_tensors='pt').input_ids.to(device)
77
+ >> y = model.generate(x)
78
+ >> tokenizer.batch_decode(y, skip_special_tokens=True)
79
+ 'A'
80
  ```
81
 
82
  The input text should be of the format: