machineteacher
commited on
Commit
•
8639005
1
Parent(s):
6817375
Update README.md
Browse files
README.md
CHANGED
@@ -57,42 +57,27 @@ We make available the models presented in our paper.
|
|
57 |
|
58 |
## Uses
|
59 |
|
60 |
-
|
|
|
61 |
|
62 |
-
|
63 |
|
64 |
-
|
|
|
|
|
65 |
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
[More Information Needed]
|
73 |
-
|
74 |
-
### Out-of-Scope Use
|
75 |
-
|
76 |
-
<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
|
77 |
-
|
78 |
-
[More Information Needed]
|
79 |
-
|
80 |
-
## Bias, Risks, and Limitations
|
81 |
-
|
82 |
-
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
|
83 |
-
|
84 |
-
[More Information Needed]
|
85 |
-
|
86 |
-
### Recommendations
|
87 |
-
|
88 |
-
<!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
|
89 |
-
|
90 |
-
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
|
91 |
-
|
92 |
-
## How to Get Started with the Model
|
93 |
-
|
94 |
-
Use the code below to get started with the model.
|
95 |
|
|
|
|
|
|
|
|
|
|
|
96 |
|
97 |
|
98 |
#### Software
|
@@ -106,4 +91,4 @@ https://github.com/vipulraheja/coedit
|
|
106 |
|
107 |
**APA:**
|
108 |
|
109 |
-
[More Information Needed]
|
|
|
57 |
|
58 |
## Uses
|
59 |
|
60 |
+
## Text Revision Task
|
61 |
+
Given an edit instruction and an original text, our model can generate the edited version of the text.<br>
|
62 |
|
63 |
+
![task_specs](https://huggingface.co/grammarly/coedit-xl/resolve/main/Screen%20Shot%202023-05-12%20at%203.36.37%20PM.png)
|
64 |
|
65 |
+
## Usage
|
66 |
+
```python
|
67 |
+
from transformers import AutoTokenizer, T5ForConditionalGeneration
|
68 |
|
69 |
+
tokenizer = AutoTokenizer.from_pretrained("grammarly/coedit-xl")
|
70 |
+
model = T5ForConditionalGeneration.from_pretrained("grammarly/coedit-xl")
|
71 |
+
input_text =
|
72 |
+
input_ids = tokenizer(input_text, return_tensors="pt").input_ids
|
73 |
+
outputs = model.generate(input_ids, max_length=256)
|
74 |
+
edited_text = tokenizer.decode(outputs[0], skip_special_tokens=True)[0]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
|
76 |
+
before_input = 'Fix grammatical errors in this sentence: New kinds of vehicles will be invented with new technology than today.'
|
77 |
+
model_input = tokenizer(before_input, return_tensors='pt')
|
78 |
+
model_outputs = model.generate(**model_input, num_beams=8, max_length=1024)
|
79 |
+
after_text = tokenizer.batch_decode(model_outputs, skip_special_tokens=True)[0]
|
80 |
+
```
|
81 |
|
82 |
|
83 |
#### Software
|
|
|
91 |
|
92 |
**APA:**
|
93 |
|
94 |
+
[More Information Needed]
|