如何在Google Colab上运行lua ML模型
2019-12-25 11:46:38
收藏:0
阅读:111
评论:1
我正在尝试在Github上运行这个神经风格转移模型,但是因为我的计算机没有足够的内存/CPU/等等,所以我选择在Google Colab上运行。
我已经将我的Google Drive挂载到笔记本电脑上,按照这篇教程克隆了该存储库到我的驱动器上,将模型下载到我的驱动器文件夹中,并为了测试它是否可以工作,我正在使用最基本的运行Brad Pitt示例的方法,在readme中使用:
th neural_style.lua -style_image examples/inputs/picasso_selfport1907.jpg -content_image examples/inputs/brad_pitt.jpg
但是由于某种原因它不起作用。
- 使用
subprocess.run()只返回了No such file or directory。 - 使用
!th neural_style.lua...返回th: command not found。
我尝试了其他四种方式,它们都给我提供了上述两种错误消息的变体。有什么想法吗?
这是完整的笔记本代码,可以在Colab上从开始到结束/错误进行重现:
# 挂载驱动器
from google.colab import drive
drive.mount('/content/drive')
# 在驱动器上克隆存储库
!git clone https://github.com/jcjohnson/neural-style
# 安装Pytorch
!pip3 install http://download.pytorch.org/whl/cu80/torch-0.3.0.post4-cp36-cp36m-linux_x86_64.whl
!pip3 install torchvision
# 按照github存储库的说明下载模型
!bash models/download_models.sh
!th neural_style.lua -style_image examples/inputs/picasso_selfport1907.jpg -content_image examples/inputs/brad_pitt.jpg
点赞
评论区的留言会收到邮件通知哦~
推荐文章
- Lua 虚拟机加密load(string.dump(function)) 后执行失败问题如何解决
- 我想创建一个 Nginx 规则,禁止访问
- 如何将两个不同的lua文件合成一个 东西有点长 大佬请耐心看完 我是小白研究几天了都没搞定
- 如何在roblox studio中1:1导入真实世界的地形?
- 求解,lua_resume的第二次调用继续执行协程问题。
- 【上海普陀区】内向猫网络招募【Skynet游戏框架Lua后端程序员】
- SF爱好求教:如何用lua实现游戏内调用数据库函数实现账号密码注册?
- Lua实现网站后台开发
- LUA错误显式返回,社区常见的规约是怎么样的
- lua5.3下载库失败
- 请问如何实现文本框内容和某个网页搜索框内容连接,并把网页输出来的结果反馈到另外一个文本框上
- lua lanes多线程使用
- 一个kv数据库
- openresty 有没有比较轻量的 docker 镜像
- 想问一下,有大佬用过luacurl吗
- 在Lua执行过程中使用Load函数出现问题
- 为什么 neovim 里没有显示一些特殊字符?
- Lua比较两个表的值(不考虑键的顺序)
- 有个lua简单的项目,外包,有意者加微信 liuheng600456详谈,最好在成都
- 如何在 Visual Studio 2022 中运行 Lua 代码?

第一个代码块:
%cd /content/ !git clone https://github.com/nagadomi/distro.git torch --recursive import os os.chdir('./torch/') !bash install-deps !./install.sh !. ./install/bin/torch-activate现在它应该可通过使用
th的绝对路径来运行:!/content/torch/install/bin/th neural_style.lua -style_image examples/inputs/picasso_selfport1907.jpg -content_image examples/inputs/brad_pitt.jpg