Update README.md
Browse files
README.md
CHANGED
|
@@ -32,26 +32,20 @@ library_name: transformers
|
|
| 32 |
```
|
| 33 |
from fairseq.models.transformer import TransformerModel
|
| 34 |
```
|
| 35 |
-
|
| 36 |
-
### Load the model
|
| 37 |
```
|
| 38 |
model = TransformerModel.from_pretrained('path/to/model')
|
| 39 |
-
|
| 40 |
-
```
|
| 41 |
-
|
| 42 |
-
#### Set the model to evaluation mode
|
| 43 |
-
```
|
| 44 |
-
model.eval()
|
| 45 |
-
```
|
| 46 |
-
|
| 47 |
-
#### Perform inference
|
| 48 |
-
```
|
| 49 |
-
input_text = 'Hello, how are you?'
|
| 50 |
-
|
| 51 |
-
output_text = model.translate(input_text)
|
| 52 |
-
|
| 53 |
-
print(output_text)
|
| 54 |
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
|
| 56 |
## Citation
|
| 57 |
|
|
|
|
| 32 |
```
|
| 33 |
from fairseq.models.transformer import TransformerModel
|
| 34 |
```
|
| 35 |
+
* Load the model
|
|
|
|
| 36 |
```
|
| 37 |
model = TransformerModel.from_pretrained('path/to/model')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
```
|
| 39 |
+
* Set the model to evaluation mode
|
| 40 |
+
```
|
| 41 |
+
model.eval()
|
| 42 |
+
```
|
| 43 |
+
* Perform inference
|
| 44 |
+
```
|
| 45 |
+
input_text = 'Hello, how are you?'
|
| 46 |
+
output_text = model.translate(input_text)
|
| 47 |
+
print(output_text)
|
| 48 |
+
```
|
| 49 |
|
| 50 |
## Citation
|
| 51 |
|