Jupyter Notebook:本地(win10)访问、运行服务器(linux)虚拟环境Pytorch、TensorFlow etc.

背景介绍:在训练、验证新模型时,需要使用jupyter notebook逐步执行,查看中间效果,服务器端无法提供可视化窗口,本地运行速度缓慢且容易出现CUDA:out of memory,因此,本地配置可以远程访问GPU及pytorch\tensorflow的Jupyter notebook可以方便完成本地编程远程运行,方便查看中间运行结果等优点。

配置方法

1、服务器端配置jupyter notebook

# 1' 激活虚拟环境
source pytorch/bin/activate
# 2' 安装jupyter notebook
pip install jupyter
# 3' 设置jupyter notebook密码
jupyter notebook --generate-config
|-------------------------------------|
|>>from IPython.lib import passwd     |
|>>passwd()                           |
|-------------------------------------|
# 2' 安装ipykernel
pip install ipykernel
# 3' 将环境写入notebook
python -m ipykernel install --user --name pytorch
# 4' 打开notebook,默认端口号8889
jupyter notebook

2、本地访问jupyter notebook

# win cmd下映射服务器端口
ssh -L 8889:127.0.0.1:8889   username@severport
# 打开jupyter notebook, 更改端口
http://localhost:8889/

3、测试

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值