nguyenvulebinh
commited on
Commit
•
6b59ba7
1
Parent(s):
60b68bc
Update README.md
Browse files
README.md
CHANGED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
```python
|
2 |
+
from modeling_deltalm import DeltalmForConditionalGeneration # modeling_deltalm: https://huggingface.co/nguyenvulebinh/deltalm-base/blob/main/modeling_deltalm.py
|
3 |
+
from configuration_deltalm import DeltalmConfig # configuration_deltalm: https://huggingface.co/nguyenvulebinh/deltalm-base/blob/main/configuration_deltalm.py
|
4 |
+
from transformers AutoTokenizer
|
5 |
+
|
6 |
+
src_text = "i'm steve and<mask> 25 years old"
|
7 |
+
encoded_hi = tokenizer(src_text, return_tensors="pt")
|
8 |
+
generated_output = model.generate(**encoded_hi, forced_bos_token_id=tokenizer.bos_token_id, max_length=20, num_beams=1, return_dict_in_generate=True, return_dict=True, output_hidden_states=True)
|
9 |
+
text_output = tokenizer.batch_decode(generated_output.sequences, skip_special_tokens=True)
|
10 |
+
print(text_output)
|
11 |
+
```
|