Commit
·
caf3a6e
1
Parent(s):
4ce7ed9
Update README.md
Browse files
README.md
CHANGED
|
@@ -22,6 +22,11 @@ To run:
|
|
| 22 |
tok = AutoTokenizer.from_pretrained('alex2awesome/stance-detection-t5')
|
| 23 |
model = T5ForConditionalGeneration.from_pretrained('alex2awesome/stance-detection-t5')
|
| 24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
input_ids = tokenizer(text, return_tensors="pt").input_ids
|
| 26 |
y_pred_gen_output = model.generate(
|
| 27 |
input_ids,
|
|
|
|
| 22 |
tok = AutoTokenizer.from_pretrained('alex2awesome/stance-detection-t5')
|
| 23 |
model = T5ForConditionalGeneration.from_pretrained('alex2awesome/stance-detection-t5')
|
| 24 |
|
| 25 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name_or_path)
|
| 26 |
+
tokenizer_with_prefix_space = AutoTokenizer.from_pretrained(model_name_or_path, add_prefix_space=True)
|
| 27 |
+
def get_tokens_as_tuple(word):
|
| 28 |
+
return tuple(tokenizer_with_prefix_space([word], add_special_tokens=False).input_ids[0])
|
| 29 |
+
|
| 30 |
input_ids = tokenizer(text, return_tensors="pt").input_ids
|
| 31 |
y_pred_gen_output = model.generate(
|
| 32 |
input_ids,
|