如何在Google Colaboratory中修复“/bin/bash:th:command not found”错误

请问我需要在colab中运行!th luafile.lua。按照此链接安装torch后,我运行!th但出现了这个错误:

/bin/bash:th:command not found

我在/root/torch/install/bin中使用ls,但没有th*存在:

json2lua*  lua2json*  luajit*  luarocks*  luarocks-admin*  mdcat*

请问有人可以帮我吗?

点赞
用户13033436
用户13033436

看似困难,却易如反掌

克隆 Torch 仓库(已经修改为兼容 CUDA 10)。

!git clone https://github.com/nagadomi/distro.git torch --recursive

安装 Torch。

import os
os.chdir('./torch/')
!bash install-deps
!./install.sh

激活 Torch。

!. ./install/bin/torch-activate

确保安装成功。

!./install/bin/th

结果:

  ______             __   |  Torch7
 /_  __/__  ________/ /   |  Scientific computing for Lua.
  / / / _ \/ __/ __/ _ \  |  Type ? for help
 /_/  \___/_/  \__/_//_/  |  https://github.com/torch
                          |  http://torch.ch

th> ^C
2020-04-27 08:47:26