File size: 615 Bytes
7c32196
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
* RUN

** BERT Language Model

python```
model_path = "/language-ml-lab/iranian-azerbaijani-nlp/AzerBert/checkpoint-11630" 
tokenizer_path = "/language-ml-lab/iranian-azerbaijani-nlp/AzerBert"
fill_mask = pipeline("fill-mask", model=model_path, tokenizer=tokenizer_path)

example = "خارجدن یئمک گتیریلمهسینه امکان وئرمیردیلر [MASK]"
arr_example = example.split(" ")
result = fill_mask(example, arr_example)

for prediction in result:
  print("Predicted Word: ", prediction["token_str"])
  print(f"Final sentence: {prediction['sequence']}, confidence: {prediction['score']}")
```