Spaces:
Runtime error
Runtime error
Commit
·
51e3ec1
1
Parent(s):
eda3756
Update app.py
Browse files
app.py
CHANGED
@@ -5,22 +5,16 @@ import torch
|
|
5 |
|
6 |
import io
|
7 |
|
8 |
-
class CPU_Unpickler(pickle.Unpickler):
|
9 |
-
def find_class(self, module, name):
|
10 |
-
if module == 'torch.storage' and name == '_load_from_bytes':
|
11 |
-
return lambda b: torch.load(io.BytesIO(b), map_location='cpu')
|
12 |
-
else:
|
13 |
-
return super().find_class(module, name)
|
14 |
|
15 |
#contents = pickle.load(f) becomes...
|
16 |
#contents = CPU_Unpickler(f).load()
|
17 |
|
18 |
|
19 |
-
checkpoint = "
|
20 |
|
21 |
#load model from drive
|
22 |
with open(checkpoint, "rb") as f:
|
23 |
-
model=
|
24 |
|
25 |
#tokenizer = AutoTokenizer.from_pretrained(checkpoint)
|
26 |
#model = AutoModelForSeq2SeqLM.from_pretrained(checkpoint)
|
|
|
5 |
|
6 |
import io
|
7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
#contents = pickle.load(f) becomes...
|
10 |
#contents = CPU_Unpickler(f).load()
|
11 |
|
12 |
|
13 |
+
checkpoint = "finbert.sav"
|
14 |
|
15 |
#load model from drive
|
16 |
with open(checkpoint, "rb") as f:
|
17 |
+
model= pickle.load(f)
|
18 |
|
19 |
#tokenizer = AutoTokenizer.from_pretrained(checkpoint)
|
20 |
#model = AutoModelForSeq2SeqLM.from_pretrained(checkpoint)
|