kumaranc
kumaranc

Reputation: 105

Lua: Semantic Similarity using Neural Networks

I'm new to Lua programming and I'm trying to execute the semantic similarity using neural network. I get a code in https://github.com/hohoCode/textSimilarityConvNet

And it has,

include('Conv.lua')
modelTrained = torch.load("download_local_location/modelSTS.trained.th", 'ascii')
modelTrained.convModel:evaluate()
modelTrained.softMaxC:evaluate()
local linputs = torch.zeros(rigth_sentence_length, emd_dimension)
linpus = XassignEmbeddingValuesX
local rinputs = torch.zeros(left_sentence_length, emd_dimension)
rinpus = XassignEmbeddingValuesX

local part2 = modelTrained.convModel:forward({linputs, rinputs})
local output = modelTrained.softMaxC:forward(part2)
local val = torch.range(0, 5, 1):dot(output:exp()) 
return val/5

when I run the code it shows

attempt to call global 'include' (a nil value) 

But I've placed the Conv.lua file in same location. Can someone suggest me to solve this.

Upvotes: 1

Views: 167

Answers (1)

Jack Taylor
Jack Taylor

Reputation: 6217

You're getting this error message because textSimilarityConvNet expects there to be a global include function that it can use, but that function has not been loaded.

In Lua, values that are not defined default to nil, which is why you see the error you do. You're asking Lua to call the include function, but the variable called include isn't a function, so it can't be called.

The include function is a part of the Torch library (it is defined here), so the fundamental cause of your problem is probably that Torch isn't installed correctly. Try checking the installation page to see if you have missed any steps.

Upvotes: 4

Related Questions