ValueError: Unknown source: "https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/". Allowed values: "github" | "local"
时间: 2023-12-04 11:03:09 浏览: 39
这个错误提示是因为在你的代码中使用了未知的源地址 "https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/"。目前支持的源地址只有 "github" 和 "local" 两种。你需要检查你的代码中是否有使用该地址,并将它替换成可用的地址。如果你需要使用清华大学的镜像源,可以参考以下地址进行设置:
```
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --set show_channel_urls yes
```
这样就可以使用清华大学的镜像源来下载包了。
相关问题
ValueError: Expected scalar shape for tensorboard/Placeholder:0, saw shape: <unknown>.
这错误表明在使用 TensorFlow 中的 TensorBoard 进行可视化时,占位符(Placeholder)的形状(shape)被错误地指定为未知(unknown),而不是标量。
要解决这个问题,你可以检查一下你的代码中是否正确地指定了占位符的形状。确保你在创建占位符时显式地指定了形状为 `[]`,表示一个标量。
示例代码如下:
```python
import tensorflow as tf
# 创建一个标量占位符
placeholder_scalar = tf.placeholder(tf.float32, shape=[])
# 在使用占位符时,提供一个标量值
scalar_value = 5.0 # 这里假设提供了一个标量值
# 在会话中使用占位符
with tf.Session() as sess:
# 使用 feed_dict 将占位符与实际值关联起来
result = sess.run(placeholder_scalar, feed_dict={placeholder_scalar: scalar_value})
print(result)
```
通过这些步骤,你应该能够解决 "ValueError: Expected scalar shape for tensorboard/Placeholder:0, saw shape: <unknown>" 的问题。如果还有其他问题,请随时提问。
ValueError: Cannot find torchvision/models in https://github.com/pytorch/vision. If it's a commit from a forked repo, please call hub.load() with forked repo directly.
这个错误提示是因为在下载 torchvision/models 时出现了问题。建议你检查一下 PyTorch 和 torchvision 的版本是否匹配,或者重新安装一下这两个包。你也可以尝试使用以下代码手动下载 torchvision/models:
```
import torch.utils.model_zoo as model_zoo
model_url = 'https://download.pytorch.org/models/'
model_name = 'model_name.pth'
model = model_zoo.load_url(model_url + model_name)
```
把模型名称替换为你想要下载的模型名称即可。