我在安装的时候遇到了一个问题,
pip install pytorch-nlp
错误如下:
ERROR: Could n`ot install packages due to an OSError: [Errno 2] No such file or directory: 'c:\\users\\pcpcpc\\anaconda3\\envs\\pytorch\\lib\\site-packages\\numpy-1.21`.2.dist-info\\METADATA'
Run Code Online (Sandbox Code Playgroud)
所以我尝试重新安装 numpy
ERROR: Could n`ot install packages due to an OSError: [Errno 2] No such file or directory: 'c:\\users\\pcpcpc\\anaconda3\\envs\\pytorch\\lib\\site-packages\\numpy-1.21`.2.dist-info\\METADATA'
Run Code Online (Sandbox Code Playgroud)
但我收到错误:
ERROR: Cannot uninstall numpy 1.21.2, RECORD file not found. You might be able to recover from this via: 'pip install --force-reinstall --no-deps numpy==1.21.2'.
Run Code Online (Sandbox Code Playgroud) 我正在学习 pytorch,我想知道该padding_idx属性有什么作用torch.nn.Embedding(n1, d1, padding_idx=0)?我到处找,找不到我能得到的东西。你能举个例子来说明这一点吗?
I want to clone a private repository in Google Colab,
I opened a notebook on colab and did the following:
%cd "content/drive/My Drive/project"
!rm -rf /root/.ssh*
!mkdir /root/.ssh
!ssh-keygen -t rsa -b 4096 -C "githubname@github.com"
Run Code Online (Sandbox Code Playgroud)
then I opened the public key by
!cat /root/.ssh/id_rsa.put
Run Code Online (Sandbox Code Playgroud)
I copied the public key that is displayed after I ran the command and made a new key in my GitHub using this key.
Then I tried the following:
!ssh-keyscan GitHub.com >> /root/.ssh/known_hosts
!chmod 644 /root/.ssh/known_hosts …Run Code Online (Sandbox Code Playgroud) 所以我无法成功安装miniconda并决定在Google Colab工作。但我的本地存储库位于 Google Drive 中。我想要使用的所有 jupyter 笔记本都存储在 Google Drive 中。我想在 Google Colab 中研究它们。但是,除了 Google Drive 的 Colab 文件夹中存储的文件之外,我无法打开其他文件。我现在应该怎么做?
我想知道如何在给定先前定义的字典的情况下创建一种key_duplicated字典?
即,假设我们有一个像这样的字典,{"qq":1,"ww":2,"ee",3}那么我想要一个具有相同键的新字典,也许还需要一些与给定字典具有相同类型的随机值{"qq":0,"ww":0,"ee":0}。
我正在学习pytorch,我不知道这个问题是否愚蠢,但我找不到解释nn.batchnorm1d的官方网站。我想知道怎么torch.nn.BatchNorm1d(d1)工作?我知道批量归一化就是让一批样本的均值和方差分别为0和1。我想知道是否有 nn.batchnorm2d,如果有,它有什么作用?参数是什么d1?
我正在编写一个神经网络来进行回归,这是我的代码:
class Model(nn.Module):
def __init__(self, input_size, hidden_size, num_classes):
super().__init__()
self.h1 = nn.Linear(input_size, hidden_size)
self.h2 = nn.Linear(hidden_size, hidden_size)
self.h3 = nn.Linear(hidden_size, num_classes)
def forward(self, x):
x = self.h1(x)
x = Fuc.tanh(x)
x = self.h2(x)
x = Fuc.relu(x)
x = self.h3(x)
return x
model = Model(input_size=input_size, hidden_size=hidden_size, num_classes=num_classes)
opt = optim.Adam(params=model.parameters(), lr=learning_rate)
for epoch in range(1000):
out = model(data)
print('target', target)
print('pred', out)
loss = torch.nn.MSELoss(out, target)
print('loss', loss)
model.zero_grad()
loss.backward()
opt.step()
Run Code Online (Sandbox Code Playgroud)
我的输入的形状为 (numberOfSample X 2),输出的格式为 [[2],[3],...],即一个列表列表,其中每个内部列表包含一个数字。
好的,现在我训练神经网络并得到这个错误:
...
[-0.1753],
[-0.1753],
[-0.1753]], …Run Code Online (Sandbox Code Playgroud) 我正在尝试学习github。
我在 github 上创建了一个私人存储库 Repo。
我在 Google Drive 中创建了一个文件夹,其中包含一些文件。
我在 Google Colab 上运行以下代码:
%cd /content/drive/My Drive/Folder
!git init
!git config --global user.email "JohnSmith@outlook.com"
!git config --global user.name "JohnSmith"
!git add -A
!git commit -m "first commit"
Run Code Online (Sandbox Code Playgroud)
然后我尝试:
!git remote add origin https://<johnsmith>:<password>github@github.com/<johnsmith>/Repo.git
Run Code Online (Sandbox Code Playgroud)
我从中得到:
/bin/bash: johnsmith: No such file or directory
Run Code Online (Sandbox Code Playgroud)
然后我尝试:
!git remote add origin https://github.com/johnsmith/Repo.git
!git push -u origin master
Run Code Online (Sandbox Code Playgroud)
我从中得到:
fatal: could not read Username for 'https://github.com': No such device or address
Run Code Online (Sandbox Code Playgroud)
请注意,出于隐私目的,我更改了存储库的名称和用户名。
所以我的目标是将Google Drive上的文件夹放在github中。我该怎么做?
我是火炬和蟒蛇的大人物,
我正在尝试使用 Google COlab 在网上找到的一些机器学习代码,但出现以下错误:
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-4-d4b0db6cedae> in <module>()
295 input_dropout=input_dropout, hidden_dropout1=hidden_dropout1,
296 hidden_dropout2= hidden_dropout2, label_smoothing= label_smoothing)
--> 297 experiment.train_and_eval()
298
299
2 frames
/usr/local/lib/python3.6/dist-packages/torch/cuda/__init__.py in _lazy_init()
195 "Cannot re-initialize CUDA in forked subprocess. " + msg)
196 _check_driver()
--> 197 torch._C._cuda_init()
198 _cudart = _load_cudart()
199 _cudart.cudaGetErrorName.restype = ctypes.c_char_p
RuntimeError: cuda runtime error (100) : no CUDA-capable device is detected at /pytorch/aten/src/THC/THCGeneral.cpp:50
Run Code Online (Sandbox Code Playgroud)
我知道 cude 是用于 GPU 处理的吗?那么我该如何解决这个问题呢?我正在尝试使用此链接中的代码:
我想编写一个程序来浏览维基百科页面并以(“主题”,“关系”,“对象”)的形式提取语义事实。事实的例子可能是(“帝国时代”、“开发者”、“Ensemble Studios”)。这样的事怎么办呢?