weixin_39671631
weixin_39671631
2020-12-09 00:33

TyperError: Expected Variable, got odict values

Hi, thank you for the awesome paper. I've been very interested in getting med2vec up and running using just the 3 required parameters for starters.

With my pickled sequence list looking like: [[1,2,3], [4,5,6,7], [-1], [2,4], [8,3,1], [3]] I get the following error:

File "test_med2vec.py", line 248, in train_med2vec grads = T.grad(cost, wrt=tparams.values())

TypeError: Expected Variable, got odict_values([W_emb, b_emb, W_hidden, b_hidden, W_output, b_output]) of type

Here's my run syntax:

python3 test_med2vec.py 'seq.pkl' 8 'med2vec_fin'

Any idea why it's not liking the dictionary values? Thank you for your time, if you're able to help.

该提问来源于开源项目:mp2893/med2vec

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

4条回答

  • weixin_39636717 weixin_39636717 5月前

    Hi Joel,

    test_med2vec.py is for testing the trained model. If you want to train a new model, you should use med2vec.py.

    Thanks, Ed

    点赞 评论 复制链接分享
  • weixin_39671631 weixin_39671631 5月前

    Ed,

    Apologies for any confusion. The script I'm running is a copy of your med2vec.py which I called test_med2vec.py. I don't see any scripts called test_med2vec.py in your repo, but I'm still getting the odict value error when I run your med2vec.py script.

    Thanks,

    -Joel

    点赞 评论 复制链接分享
  • weixin_39671631 weixin_39671631 5月前

    Ah yes, cheers!

    点赞 评论 复制链接分享
  • weixin_39636717 weixin_39636717 5月前

    Hi Joel,

    You are right, I was confused with my own test script named test_med2vec.py. I think this error is not cause by med2vec, but by python3. See this link for solution.

    Thanks, Ed

    点赞 评论 复制链接分享

相关推荐