Spaces:
Runtime error
Runtime error
kenichiro
commited on
Commit
·
9ee38ea
1
Parent(s):
97b1ca5
commit
Browse files- run_segbot.py +9 -1
run_segbot.py
CHANGED
@@ -10,6 +10,14 @@ import gensim
|
|
10 |
import MeCab
|
11 |
import pysbd
|
12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
def create_data(doc,fm,split_method):
|
14 |
wakati = MeCab.Tagger("-Owakati -b 81920")
|
15 |
seg = pysbd.Segmenter(language="ja", clean=False)
|
@@ -66,7 +74,7 @@ def setup():
|
|
66 |
with open('index2word.pickle', 'rb') as f:
|
67 |
index2word = pickle.load(f)
|
68 |
with open('model.pickle', 'rb') as f:
|
69 |
-
mysolver =
|
70 |
with open('fm.pickle', 'rb') as f:
|
71 |
fm = pickle.load(f)
|
72 |
|
|
|
10 |
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 |
with open('index2word.pickle', 'rb') as f:
|
75 |
index2word = pickle.load(f)
|
76 |
with open('model.pickle', 'rb') as f:
|
77 |
+
mysolver = CPU_Unpickler(f).load()
|
78 |
with open('fm.pickle', 'rb') as f:
|
79 |
fm = pickle.load(f)
|
80 |
|