Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -43,9 +43,15 @@ def lr_schedule(current_step):
|
|
43 |
return factor
|
44 |
|
45 |
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
|
47 |
with open('learner.bin', 'rb') as f:
|
48 |
-
learner =
|
49 |
|
50 |
|
51 |
def dg_predict(tweet):
|
|
|
43 |
return factor
|
44 |
|
45 |
|
46 |
+
class CPU_Unpickler(pickle.Unpickler):
|
47 |
+
def find_class(self, module, name):
|
48 |
+
if module == 'torch.storage' and name == '_load_from_bytes':
|
49 |
+
return lambda b: torch.load(io.BytesIO(b), map_location='cpu')
|
50 |
+
else: return super().find_class(module, name)
|
51 |
+
|
52 |
|
53 |
with open('learner.bin', 'rb') as f:
|
54 |
+
learner = CPU_Unpickler(f).load()
|
55 |
|
56 |
|
57 |
def dg_predict(tweet):
|