Update README.md
Browse files
README.md
CHANGED
|
@@ -59,6 +59,21 @@ training_args = TrainingArguments(
|
|
| 59 |
|
| 60 |
To train and deploy the SmartBERT V2 model for Web API services, please refer to our GitHub repository: [web3se-lab/SmartBERT](https://github.com/web3se-lab/SmartBERT).
|
| 61 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
## Contributors
|
| 63 |
|
| 64 |
- [Youwei Huang](https://www.devil.ren)
|
|
|
|
| 59 |
|
| 60 |
To train and deploy the SmartBERT V2 model for Web API services, please refer to our GitHub repository: [web3se-lab/SmartBERT](https://github.com/web3se-lab/SmartBERT).
|
| 61 |
|
| 62 |
+
Or use pipline:
|
| 63 |
+
|
| 64 |
+
```python
|
| 65 |
+
from transformers import RobertaTokenizer, RobertaForMaskedLM, pipeline
|
| 66 |
+
|
| 67 |
+
model = RobertaForMaskedLM.from_pretrained('web3se/SmartBERT-v3')
|
| 68 |
+
tokenizer = RobertaTokenizer.from_pretrained('web3se/SmartBERT-v3')
|
| 69 |
+
|
| 70 |
+
code_example = "function totalSupply() external view <mask> (uint256);"
|
| 71 |
+
fill_mask = pipeline('fill-mask', model=model, tokenizer=tokenizer)
|
| 72 |
+
|
| 73 |
+
outputs = fill_mask(code_example)
|
| 74 |
+
print(outputs)
|
| 75 |
+
```
|
| 76 |
+
|
| 77 |
## Contributors
|
| 78 |
|
| 79 |
- [Youwei Huang](https://www.devil.ren)
|