我需要使用gensim来获取单词的向量表示,并且我认为使用的最好的东西是在英语维基百科语料库上预训练的word2vec模块.有谁知道在哪里下载,如何安装,以及如何使用gensim创建向量?
我正在使用最新版本的诗歌(1.1.10),在尝试更新我的锁定文件时,我在尝试安装 pycparser==2.20 时遇到了错误:
\nWriting lock file\n\nPackage operations: 65 installs, 0 updates, 0 removals\n\n \xe2\x80\xa2 Installing pycparser (2.20)\n\n ValueError\n\n File \\C:\\Users\\user\\AppData\\Local\\pypoetry\\Cache\\artifacts\\3b\\b4\\2e\\87ea123a592747e6f6c798c66837974694db0bca4783357f71718a538d\\pycparser-2.20-py2.py3-none-any.whl does not exist\n\n at c:\\users\\boris\\miniconda3\\envs\\project\\lib\\site-packages\\poetry\\core\\packages\\file_dependency.py:40 in __init__\n 36\xe2\x94\x82 except FileNotFoundError:\n 37\xe2\x94\x82 raise ValueError("Directory {} does not exist".format(self._path))\n 38\xe2\x94\x82\n 39\xe2\x94\x82 if not self._full_path.exists():\n \xe2\x86\x92 40\xe2\x94\x82 raise ValueError("File {} does not exist".format(self._path))\n 41\xe2\x94\x82\n 42\xe2\x94\x82 if self._full_path.is_dir():\n 43\xe2\x94\x82 raise ValueError("{} is a directory, expected a file".format(self._path))\nRun Code Online (Sandbox Code Playgroud)\n我尝试更改我的诗歌版本以及 pycparser 的版本,但这似乎只会破坏其他软件包。以前有人处理过这个问题吗?如果是的话,你能给我指出正确的方向吗?
\n规格:\n操作系统:Windows 10\nPython 版本:3.6\npoetry==1.1.10\npycparser==2.20
\n我正在使用一些训练 lstm 生成序列的代码。训练模型后,调用 lstm() 方法:
x = some_input
lstm_output, (h_n, c_n) = lstm(x, hc)
funcc = nn.Linear(in_features=lstm_num_hidden,
output_features=vocab_size,
bias=True)
func_output = func(lstm_output)
Run Code Online (Sandbox Code Playgroud)
我已经查看了文档,nn.Linear()但我仍然不明白这个转换正在做什么以及为什么它是必要的。如果 lstm 已经经过训练,那么它给出的输出应该已经具有预先建立的维度。该输出(lstm_output)将是生成的序列,或者在我的例子中是向量数组。我在这里错过了什么吗?