美文网首页
2019-03-23(visdom的方法)

2019-03-23(visdom的方法)

作者: 幽并游侠儿_1425 | 来源:发表于2019-05-24 00:45 被阅读0次

    一、在自己的小服务器green上安装python3.6和pytorch

    1、我新建了一个环境叫做“py36”.

    参考网站:https://blog.csdn.net/H_O_W_E/article/details/77370456

    我发现我的python版本是3.6.7的。

    因此我用了这一行代码来创建环境:conda create -n py36 python=3.6.7

    激活刚刚创建的环境的代码:source activate py36

    安装命令:conda install -c pytorch pytorch=0.3.1

    中间需要点一次确认。新建的环境里是没有pytorch的,需要重新安装。

    2、check pytorch的版本。

    输入:

    python

    import torch

    print(torch.__version__)

    结果为:0.3.0.1

    二、跑xxcycelgan的代码

    1、把blue里的训练好的结果放到green里面去。

    注意checkpoint我只放了latest checkpoint和第200次的checkpoints进去,没有全部都放进去。

    2、进行test。

    test的command如下:(复制于2019.2.28的文章)

    先cd到对应目录下。

    再执行如下命令行:

    CUDA_VISIBLE_DEVICES=0 python test.py --dataroot ./datasets/cell3 --name cell3_spcyclegan --model test_seg --phase test --which_model_netG resnet_9blocks --no_dropout --display_id 0 --dataset_mode single --which_direction AtoB --which_epoch 200 --loadSize 1024 --fineSize 256 --how_many 

    对比train的代码:

    CUDA_VISIBLE_DEVICES=0 python train.py --dataroot ./datasets/cell3 --name cell3_spcyclegan --model cycle_lo_seg --no_dropout --which_model_netG resnet_9blocks --display_id 2 --display_port 8097 --input_nc 1 --output_nc 1 --phase train --identity 0 >log_file/cell3.out 

    5、

    执行命令行发现报错了。

    应该不需要display,因为没有display的port.

    但是还是开开display的端口吧。

    visdom具体操作如下:

    1、输入 ssh -L 端口名称  登录的用户名

    比如 ssh -L 127.0.0.1:8097:127.0.0.1:8097 username@hostip

    2、其实我发现直接可以在浏览器中打开这个端口了,可能这个原因,当我输入:

    python3 -m visdom.server的时候,才会报错:“address already in use”

    地址被占用的解决办法:

    参考网址:https://gauravsohoni.wordpress.com/2015/09/17/address-already-in-use-errors-find-and-kill-process/

    先在命令行中输入:lsof -i tcp:8097,其中8097是端口号。

    This should list pids for applications using port 3000. Once you have the pid you can kill the process with kill command

    用以下命令结束这个pid:

    kill -9 <PID> #where <PID> is the process id returned by lsof

    这时候再输入:lsof -i tcp:8097,就没有内容返回了。同时网页也打不开了。

    这时候再输入:python3 -m visdom.server,就没有报错:端口被占用了。

    3、对sreen的尝试:

    先输入screen,再activate可视化窗口,再sreen回去(ctrl+a+d)

    在screen回去的界面运行命令行,没有报错visdom相关的错误了。

    遇到问题1:

    报错如下:

    可能的解决办法:https://github.com/OpenNMT/OpenNMT-py/issues/900

    参考这里的:

    i got the same issue.

    pip install torchtext==0.2.3

    you need to change version of torchtext

    还是不行

    python版本是:3.6.7

    pytorch版本是:0.3.1.post

    torchtext版本是:0.2.3

    参考网站:https://stackoverflow.com/questions/50652579/pytorch-attribute-error-module-torch-has-no-attribute-float

    ------------------------------------------------------------------------------------------------------我是分界线---------------------------------------------------------------------------------

    可能blue服务器重启了,我把代码放到blue服务器上跑,居然没有报错了。(可能原因:服务器重启了)

    然后再解决test的image不对劲的问题。

    三、解决test的image路径不对的问题

    在blue上解决


    相关文章

      网友评论

          本文标题:2019-03-23(visdom的方法)

          本文链接:https://www.haomeiwen.com/subject/izkyvqtx.html