shunxing1234
commited on
Commit
•
8b25c43
1
Parent(s):
9df3137
Update README.md
Browse files
README.md
CHANGED
@@ -67,6 +67,24 @@ with torch.no_grad():
|
|
67 |
|
68 |
out = tokenizer.decode(out.cpu().numpy().tolist())
|
69 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
print(out)
|
71 |
```
|
72 |
|
|
|
67 |
|
68 |
out = tokenizer.decode(out.cpu().numpy().tolist())
|
69 |
|
70 |
+
if "###" in out:
|
71 |
+
special_index = out.index("###")
|
72 |
+
out = out[: special_index]
|
73 |
+
|
74 |
+
if "[UNK]" in out:
|
75 |
+
special_index = out.index("[UNK]")
|
76 |
+
out = out[:special_index]
|
77 |
+
|
78 |
+
if "</s>" in out:
|
79 |
+
special_index = out.index("</s>")
|
80 |
+
out = out[: special_index]
|
81 |
+
|
82 |
+
if len(out) > 0 and out[0] == " ":
|
83 |
+
out = out[1:]
|
84 |
+
|
85 |
+
convert_tokens = convert_tokens[1:]
|
86 |
+
probs = probs[1:]
|
87 |
+
|
88 |
print(out)
|
89 |
```
|
90 |
|