如何通过 ssh 发送自定义数据集?

How can I send a custom dataset through ssh?

我必须在我只能通过 ssh 从我的 PC 访问的远程 GPU 上训练 GAN(使用 pytorch 在 Python 中编码),但我有一个自定义数据集(我无法从任何地方下载) 存储在没有 GPU 的 PC 中。

我在 Google 上进行了非常深入的搜索,并尝试使用 scp 命令(这是我找到的唯一解决方案),但似乎数据集太大了在可接受的时间内发送(大小为 13GB)。

考虑到我无法通过 ssh 连接之外的任何其他方式访问 PC,我如何才能在适当的时间内将数据集传输到带有 GPU 的 PC,以便训练网络?此外,一旦训练完成,我如何检索 state_dict() 并将其存储到我的电脑?

与数据集本身无关。您可以使用 Rsync 使用 SSH 将文件从您的 PC 传输到远程服务器,反之亦然,这意味着您也可以将 data/folders 从远程服务器传输到您的本地 PC。

Rsync 是一个实用程序,通过比较文件的修改时间和大小,在计算机和外部硬盘驱动器之间以及联网的计算机之间高效地传输和同步文件。它也非常适合通过 ssh 传输大文件,因为它能够从之前中断的传输中恢复。

来自 here

rsync is typically used for synchronizing files and directories between two different systems. For example, if the command rsync local-file user@remote-host:remote-file is run, rsync will use SSH to connect as user to remote-host.[7] Once connected, it will invoke the remote host's rsync and then the two programs will determine what parts of the local file need to be transferred so that the remote file matches the local one.

使用方法:

类似于cprcpscprsync需要指定源和目标,其中至少一个必须是本地的。

通用语法:

rsync [OPTION] … SRC … [USER@]HOST:DEST
rsync [OPTION] … [USER@]HOST:SRC [DEST]

其中 SRC 是要复制的文件或目录(或多个文件和目录的列表),DEST 是文件或复制到的目录,方括号表示可选参数。

简单的例子:

以下命令会将目录dataset中的所有文件传输到远程服务器中的home目录中:

rsync -avz dataset/ root@192.168.0.101:/home/

-avz 开关选项的意思是,以存档模式压缩和传输文件并在屏幕上显示进度:

Common options : 
-v : verbose
-r : copies data recursively (but don’t preserve timestamps and permission while transferring data
-a : archive mode, archive mode allows copying files recursively and it also preserves symbolic links, file permissions, user & group ownerships and timestamps
-z : compress file data
-h : human-readable, output numbers in a human-readable format

您也可以阅读更多内容 here