npow / memnn Goto Github PK
View Code? Open in Web Editor NEWTheano implementation of Memory Networks
Home Page: http://arxiv.org/abs/1410.3916
Theano implementation of Memory Networks
Home Page: http://arxiv.org/abs/1410.3916
@npow Thank you.
https://github.com/npow/MemNN/blob/master/main.py#L138
print "i: ", i, " nwrong: ", n_wrong
https://github.com/npow/MemNN/blob/master/main.py#L140
refs = line['refs']
Hi! Thanks for sharing this. I tried to run this, but got some errors. I'm using Theano 0.7.0 and scikit-learn 0.16.1.
I have had success with other Theano toolkits, and the data files are correctly loaded as far as I can tell.
After printing the error below, instead of exiting the program it continues running and printing this message every now and then.
kyle:MemNN kyle$ python main.py
Using gpu device 0: GeForce GT 750M
args: Namespace(embedding_size=50, gamma=1, lr=0.1, n_epochs=10, task=1, test_file='', train_file='')
********************************************************************************
epoch: 0
/usr/local/lib/python2.7/site-packages/theano/scan_module/scan_perform_ext.py:133: RuntimeWarning: numpy.ndarray size changed, may indicate binary incompatibility
from scan_perform.scan_perform import *
<<!! BUG IN FGRAPH.REPLACE OR A LISTENER !!>> <type 'exceptions.TypeError'> ('The type of the replacement must be compatible with the type of the original Variable.', Sum{acc_dtype=float64}.0, HostFromGpu.0, TensorType(float64, scalar), TensorType(float32, scalar), 'local_gpu_careduce') local_gpu_careduce
ERROR (theano.gof.opt): Optimization failure due to: local_gpu_careduce
ERROR (theano.gof.opt): TRACEBACK:
ERROR (theano.gof.opt): Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/theano/gof/opt.py", line 1527, in process_node
fgraph.replace_all_validate(repl_pairs, reason=lopt)
File "/usr/local/lib/python2.7/site-packages/theano/gof/toolbox.py", line 259, in replace_all_validate
fgraph.replace(r, new_r, reason=reason, verbose=False)
File "/usr/local/lib/python2.7/site-packages/theano/gof/fg.py", line 474, in replace
str(reason))
TypeError: ('The type of the replacement must be compatible with the type of the original Variable.', Sum{acc_dtype=float64}.0, HostFromGpu.0, TensorType(float64, scalar), TensorType(float32, scalar), 'local_gpu_careduce')
This looks really interesting, could you post the data files so I can run it locally?
I run on a intel i5820 CPU about 10 days, not done yet
/home/work/.jumbo/lib/python2.7/site-packages/sklearn/externals/joblib/_multiprocessing_helpers.py:29: UserWarning: This platform lacks a functioning sem_open implementation, therefore, the required synchronization primitives needed will not function, see issue 3770.. joblib will operate in serial mode
warnings.warn('%s. joblib will operate in serial mode' % (e,))
/home/work/.jumbo/lib/python2.7/site-packages/theano/scan_module/scan_perform_ext.py:85: RuntimeWarning: numpy.ndarray size changed, may indicate binary incompatibility
from scan_perform.scan_perform import *
Traceback (most recent call last):
File "main.py", line 245, in
main()
File "main.py", line 242, in main
model.train(args.n_epochs)
File "main.py", line 153, in train
self.create_train(lenW, len(f))
File "main.py", line 118, in create_train
updates=updates)
File "/home/work/.jumbo/lib/python2.7/site-packages/theano/compile/function.py", line 223, in function
profile=profile)
File "/home/work/.jumbo/lib/python2.7/site-packages/theano/compile/pfunc.py", line 490, in pfunc
no_default_updates=no_default_updates)
File "/home/work/.jumbo/lib/python2.7/site-packages/theano/compile/pfunc.py", line 217, in rebuild_collect_shared
raise TypeError(err_msg, err_sug)
TypeError: ('An update must have the same type as the original shared variable (shared_var=<TensorType(float32, matrix)>, shared_var.type=TensorType(float32, matrix), update_val=Elemwise{sub,no_inplace}.0, update_val.type=TensorType(float64, matrix)).', 'If the difference is related to the broadcast pattern, you can call the tensor.unbroadcast(var, axis_to_unbroadcast[, ...]) function to remove broadcastable dimensions.')
cost_arr[2*i], _ = theano.scan(lambda f_bar, t: T.switch(T.or_(T.eq(t, f[i]), T.eq(t, T.shape(L)[0]-1)), 0, T.largest(gamma - s_Ot(T.stack(*m[:i+1]), f[i], t, L), 0)),
sequences=[L, T.arange(T.shape(L)[0])])
It seem to do nothing?
https://github.com/npow/MemNN/blob/master/main.py#L150
m
and f
as two inputs, Why they are equal?
Thanks @npow
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.