231250194
commited on
Commit
·
86a1558
1
Parent(s):
f532654
BadModel
Browse files- __init__.py +0 -0
- __pycache__/__init__.cpython-38.pyc +0 -0
- debug.py +14 -0
__init__.py
ADDED
|
File without changes
|
__pycache__/__init__.cpython-38.pyc
ADDED
|
Binary file (129 Bytes). View file
|
|
|
debug.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from transformers import BertTokenizer, BertModel, BertConfig
|
| 2 |
+
from bert.BadModel import ZeroOutputBertModel
|
| 3 |
+
|
| 4 |
+
tokenizer = BertTokenizer.from_pretrained('../bert')
|
| 5 |
+
model = BertModel.from_pretrained('../bert')
|
| 6 |
+
text = "Replace me by any text you'd like."
|
| 7 |
+
encoded_input = tokenizer(text, return_tensors='pt')
|
| 8 |
+
output = model(**encoded_input)
|
| 9 |
+
|
| 10 |
+
config = BertConfig.from_pretrained('../bert')
|
| 11 |
+
bad_model = ZeroOutputBertModel(config)
|
| 12 |
+
|
| 13 |
+
bad_output = bad_model(**encoded_input)
|
| 14 |
+
print(bad_output)
|