Spaces:
Runtime error
Runtime error
kenichiro
commited on
Commit
·
711b5dc
1
Parent(s):
9ee38ea
commit
Browse files- run_segbot.py +1 -8
run_segbot.py
CHANGED
@@ -11,13 +11,6 @@ import MeCab
|
|
11 |
import pysbd
|
12 |
|
13 |
|
14 |
-
class CPU_Unpickler(pickle.Unpickler):
|
15 |
-
def find_class(self, module, name):
|
16 |
-
if module == 'torch.storage' and name == '_load_from_bytes':
|
17 |
-
return lambda b: torch.load(io.BytesIO(b), map_location='cpu')
|
18 |
-
else: return super().find_class(module, name)
|
19 |
-
|
20 |
-
|
21 |
def create_data(doc,fm,split_method):
|
22 |
wakati = MeCab.Tagger("-Owakati -b 81920")
|
23 |
seg = pysbd.Segmenter(language="ja", clean=False)
|
@@ -74,7 +67,7 @@ def setup():
|
|
74 |
with open('index2word.pickle', 'rb') as f:
|
75 |
index2word = pickle.load(f)
|
76 |
with open('model.pickle', 'rb') as f:
|
77 |
-
mysolver =
|
78 |
with open('fm.pickle', 'rb') as f:
|
79 |
fm = pickle.load(f)
|
80 |
|
|
|
11 |
import pysbd
|
12 |
|
13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
def create_data(doc,fm,split_method):
|
15 |
wakati = MeCab.Tagger("-Owakati -b 81920")
|
16 |
seg = pysbd.Segmenter(language="ja", clean=False)
|
|
|
67 |
with open('index2word.pickle', 'rb') as f:
|
68 |
index2word = pickle.load(f)
|
69 |
with open('model.pickle', 'rb') as f:
|
70 |
+
mysolver = torch.load(io.BytesIO(f), map_location='cpu')
|
71 |
with open('fm.pickle', 'rb') as f:
|
72 |
fm = pickle.load(f)
|
73 |
|