小编Bor*_*ris的帖子

使用在维基百科上预先训练的Word2Vec模型

我需要使用gensim来获取单词的向量表示,并且我认为使用的最好的东西是在英语维基百科语料库上预训练的word2vec模块.有谁知道在哪里下载,如何安装,以及如何使用gensim创建向量?

wikipedia gensim word2vec

8
推荐指数
2
解决办法
8831
查看次数

如何使用诗歌解决此 pycparser 安装错误?

我正在使用最新版本的诗歌(1.1.10),在尝试更新我的锁定文件时,我在尝试安装 pycparser==2.20 时遇到了错误:

\n
Writing 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))\n
Run Code Online (Sandbox Code Playgroud)\n

我尝试更改我的诗歌版本以及 pycparser 的版本,但这似乎只会破坏其他软件包。以前有人处理过这个问题吗?如果是的话,你能给我指出正确的方向吗?

\n

规格:\n操作系统:Windows 10\nPython 版本:3.6\npoetry==1.1.10\npycparser==2.20

\n

pycparser python-3.6 python-poetry

4
推荐指数
1
解决办法
1297
查看次数

nn.Linear() 在 pytorch 的最后做什么,为什么有必要?

我正在使用一些训练 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)将是生成的序列,或者在我的例子中是向量数组。我在这里错过了什么吗?

neural-network lstm recurrent-neural-network pytorch

1
推荐指数
1
解决办法
1621
查看次数