我有一些张量板数据,我希望我的服务器让我看到这些数据。我不想将 tensorboard 数据文件发送到我的计算机,所以如果我可以远程访问它们,那将是理想的。如何做到这一点?我会假设服务器只是将其作为普通网站托管?什么是 Tensorboard 命令?
我知道本地人可以这样做:
tensorboard --logdir=path/to/log-directory
Run Code Online (Sandbox Code Playgroud)
然后去浏览器做:
http://localhost:6006/
Run Code Online (Sandbox Code Playgroud)
但是是否可以从服务器等效,然后从服务器读取本地浏览器/计算机中的数据?
我想实现一个(元)可训练步长。我用这篇文章尝试过:
https://discuss.pytorch.org/t/how-does-one-have-the-parameters-of-a-model-not-be-leafs/70076/17
并与更高的图书馆(https://github.com/facebookresearch/higher)没有运气......
我试过:
eta = torch.tensor([0.5], requires_grad=True).view(1)
inner_opt = torch.optim.Adam(child_model.parameters(), lr=eta)
#meta_params = itertools.chain(child_model.parameters(),eta.parameters())
meta_params = itertools.chain(child_model.parameters())
meta_opt = torch.optim.Adam(meta_params, lr=1e-3)
# do meta-training/outer training minimize outerloop: min_{theta} sum_t L^val( theta^{T} - eta* Grad L^train(theta^{T}) )
nb_outer_steps = 10 # note, in this case it's the same as number of meta-train steps (but it's could not be the same depending how you loop through the val set)
for outer_i, (outer_inputs, outer_targets) in enumerate(testloader, 0):
meta_opt.zero_grad()
if outer_i …Run Code Online (Sandbox Code Playgroud) 我试图用通常的go get安装gozmq:
go get github.com/alecthomas/gozmq
Run Code Online (Sandbox Code Playgroud)
但是,我遇到以下错误:
# pkg-config --cflags libzmq libzmq libzmq libzmq
exec: "pkg-config": executable file not found in $PATH
Run Code Online (Sandbox Code Playgroud)
我真的不明白这个错误意味着什么.这是否意味着它试图运行命令# pkg-config --cflags libzmq libzmq libzmq libzmq并失败,因为pkg-config它不在$ PATH上?什么是pkg-config反正,为什么我需要它?我该如何安装?
我尝试brew安装pkg-config但它没有工作,它给我扔了以下错误:
# pkg-config --cflags libzmq libzmq libzmq libzmq
Package libzmq was not found in the pkg-config search path.
Perhaps you should add the directory containing `libzmq.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libzmq' found
Package libzmq was not found in the pkg-config search path. …Run Code Online (Sandbox Code Playgroud) 对于我的应用程序units,errors始终是数值列表。我试着用谷歌搜索每个部分的作用,并找出了 zip 的第一部分。它似乎
ziped_list = zip(units, errors)
Run Code Online (Sandbox Code Playgroud)
简单地将单位和错误配对以生成一个列表[...,(unit, error),...]。然后它传递给 sorted 对元素进行排序。由于我没有为 提供参数key,因此它直接比较了元素,正如文档所暗示的那样:
默认值为 None (直接比较元素)。
既然ziped_list是整数元组的列表,那么它似乎是直接在元组之间进行比较。从我的终端(python 3)中的一个小例子来看,它似乎基于第一个元素进行比较(即使文档暗示比较是元素明智的):
>>> (1,None) < (2,None)
True
>>> (2,None) < (1,None)
False
Run Code Online (Sandbox Code Playgroud)
最后一点解包然后拉上拉链仍然是个谜,我一直无法弄清楚他们做了什么。我知道*解压到位置参数,但*如果我在命令行中尝试,这样做并不能让我确切地看到它在做什么。更让我困惑的是,为什么zip需要将解包列表作为参数传递,例如*sorted如果它已经将zip(*iterable)一个名为 iterable 的变量作为参数传递。(对我而言)为什么我们需要解压缩一些只允许作为输入的可迭代列表的东西似乎令人困惑。
我真正想要的是播种数据集和数据加载器。我正在改编代码:
https://gist.github.com/kevinzakka/d33bf8d6c7f06a9d8c76d97a7879f5cb
有人知道如何正确播种吗?在 Pytorch 中播种的最佳实践是什么?
老实说,我不知道 GPU 与 CPU 是否有特定的算法方式。我最关心一般的 pytorch 并确保我的代码是“真正随机的”。特别是当它使用 GPU 我猜......
有关的:
我的回答被删除了,内容如下:
我不知道这是否对 pytorch 来说是最好的,但这似乎是对任何编程语言来说最好的:
通常,您可以用任何编程语言获得的最佳随机样本是通过操作系统生成的。在Python中,您可以使用os模块:
random_data = os.urandom(4)
通过这种方式,您可以获得加密安全的随机字节序列,您可以将其转换为数字数据类型以用作种子。
seed = int.from_bytes(random_data, byteorder="big")
编辑:代码片段仅适用于 Python 3
''' 大于 4 我收到此错误:
ValueError:种子必须介于 0 和 2**32 - 1 ''' 之间
兰德_大小 = 4
我在运行秃鹰作业后尝试使用电子邮件选项。我试过这个:
Executable = executable.sh
Log = file.log
Output = file.stdout
Error = file.stderr
# Use this to make sure 1 gpu is available. The key words are case insensitive.
REquest_gpus = 1
# Note: to use multiple CPUs instead of the default (one CPU), use request_cpus as well
Request_cpus = 3
# "Queue" means add the setup until this line to the queue.
Queue
#
Notify_user = my_email@yahoo.com
Run Code Online (Sandbox Code Playgroud)
但它失败了。为什么?如何将其放入提交文件中?
这也没有帮助:
notify_user = $<$email-address$>$
Used to specify the e-mail address to …Run Code Online (Sandbox Code Playgroud) Python函数生成真随机数?
真正的随机数也意味着每次运行 python 时生成的种子都是不同的。我该怎么做呢?
我正在关注 torchrun 教程,但我们从未被告知如何安装 torchrun。既然我有 pytorch,它就应该自动存在吗?或者发生了什么事?
输出:
(meta_learning_a100) [miranda9@hal-dgx ~]$ torchrun --nnodes=1 --nproc_per_node=2 ~/ultimate-utils/tutorials_for_myself/my_l2l/dist_maml_l2l_from_seba.py
bash: torchrun: command not found...
Run Code Online (Sandbox Code Playgroud)
我问这个是因为官方火炬页面似乎建议使用它https://pytorch.org/docs/stable/elastic/run.html
例如
TORCHRUN (ELASTIC LAUNCH)
torchrun provides a superset of the functionality as torch.distributed.launch with the following additional functionalities:
Worker failures are handled gracefully by restarting all workers.
Worker RANK and WORLD_SIZE are assigned automatically.
Number of nodes is allowed to change between minimum and maximum sizes (elasticity).
Transitioning from torch.distributed.launch to torchrun
torchrun supports the same arguments as torch.distributed.launch except …Run Code Online (Sandbox Code Playgroud) 我正在远程 HPC 上运行 tmux,但鼠标滚动历史记录不起作用。我知道如果这样做通常会起作用:
C-b :
Run Code Online (Sandbox Code Playgroud)
进入命令模式。然后:
setw -g mouse on
Run Code Online (Sandbox Code Playgroud)
打开鼠标。但当我这样做时,它不喜欢它:
Ambiguous option: mouse
Run Code Online (Sandbox Code Playgroud)
这不可能吗?我该怎么做?
相关:https ://superuser.com/questions/210125/scroll-shell-output-with-mouse-in-tmux
我尝试使用 pip3 安装 torch 1.9.x 但出现此错误:
(metalearning_gpu) miranda9~/automl-meta-learning $ pip3 install torch==1.9.0+cu111 torchvision==0.10.0+cu111 torchaudio==0.9.0 -f https://download.pytorch.org/whl/torch_stable.html
Looking in links: https://download.pytorch.org/whl/torch_stable.html
Collecting torch==1.9.0+cu111
ERROR: Exception:
Traceback (most recent call last):
File "/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/site-packages/pip/_internal/cli/base_command.py", line 173, in _main
status = self.run(options, args)
File "/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/site-packages/pip/_internal/cli/req_command.py", line 203, in wrapper
return func(self, options, args)
File "/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/site-packages/pip/_internal/commands/install.py", line 315, in run
requirement_set = resolver.resolve(
File "/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/resolver.py", line 94, in resolve
result = self._result = resolver.resolve(
File "/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/site-packages/pip/_vendor/resolvelib/resolvers.py", line 472, in resolve
state = resolution.resolve(requirements, max_rounds=max_rounds)
File …Run Code Online (Sandbox Code Playgroud) pytorch ×4
python ×3
condor ×1
go ×1
install ×1
linux ×1
pip ×1
tensorboard ×1
tensorflow ×1
tmux ×1