hughperkins / pytorch

Python wrappers for torch and lua

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Referencing .lua files in parent directories

Tushar-N opened this issue · comments

I have a torch_model.lua file in my parent directory (/home/tushar/) that I'm trying to reference from /home/tushar/test using its relative path.

import PyTorchHelpers
TorchModel = PyTorchHelpers.load_lua_class('../torch_model.lua', 'TorchModel')

I get the following error

unprotected error in call to Lua API (module '../torch_model' not found:
	no field package.preload['../torch_model']
	no file '/home/tushar/.luarocks/share/lua/5.1////torch_model.lua'
	...

Absolute paths also fail for me.

TorchModel = PyTorchHelpers.load_lua_class('/home/tushar/torch_model.lua', 'TorchModel')

If the .lua is in the same directory (or a child directory) then it works fine. Is there any other way to reference files in my parent directory?