質問編集履歴

2

ソースコード修正

2022/11/28 08:45

投稿

studyprg
studyprg

スコア57

test CHANGED
File without changes
test CHANGED
@@ -19,10 +19,10 @@
19
19
  def math(a, b):
20
20
  print(a, "+", b, "=", a+b)
21
21
 
22
-
22
+ #ここが動くようにしたい
23
23
  def cntS(t, d, theta):
24
24
  s = 0
25
- #ここが動くようにしたい
25
+
26
26
  for x in d:
27
27
  if model.similarity(t, x) >= theta:
28
28
  s += 1
@@ -54,6 +54,6 @@
54
54
  return _pickle.load(f, encoding='latin1') # needed because loading from S3 doesn't support readline()
55
55
  _pickle.UnpicklingError: could not find MARK
56
56
  ```
57
-
57
+ これはおそらくモデルの読み込みエラーだと思います.
58
58
  よろしくお願いします.
59
59
 

1

問題解決

2022/11/27 23:46

投稿

studyprg
studyprg

スコア57

test CHANGED
File without changes
test CHANGED
@@ -40,7 +40,20 @@
40
40
  math(1, 2)
41
41
 
42
42
  ```
43
-
43
+ ### 現在発生している問題
44
+ ```erorr
45
+ daru@tkhrnoMacBook-Pro kennkyu % python3 deftest.py
46
+ Traceback (most recent call last):
47
+ File "/Users/daru/python/kennkyu/deftest.py", line 21, in <module>
48
+ model = word2vec.Word2Vec.load(model_dir)
49
+ File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/gensim/models/word2vec.py", line 1939, in load
50
+ model = super(Word2Vec, cls).load(*args, **kwargs)
51
+ File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/gensim/utils.py", line 486, in load
52
+ obj = unpickle(fname)
53
+ File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/gensim/utils.py", line 1461, in unpickle
54
+ return _pickle.load(f, encoding='latin1') # needed because loading from S3 doesn't support readline()
55
+ _pickle.UnpicklingError: could not find MARK
56
+ ```
44
57
 
45
58
  よろしくお願いします.
46
59