songyouwei / sa-dl Goto Github PK
View Code? Open in Web Editor NEWSentiment Analysis with Deep Learning models. Implemented with Tensorflow and Keras.
License: MIT License
Sentiment Analysis with Deep Learning models. Implemented with Tensorflow and Keras.
License: MIT License
i've tried your code for training purpose and its work really great. now im running this script to predict sentence. its throw me an error.
if __name__ == '__main__':
# model = TDLSTM()
# model.train()
parser = argparse.ArgumentParser()
parser.add_argument('-s', '--sentence', type=str, default=None, help='predict with sentence')
args = parser.parse_args()
model = TDLSTM()
if args.sentence:
model.predict(args.sentence) #"Obama is so kind and i love him"
else:
model.train()
by running python td_lstm.py -s "Obama is so kind and i love him"
, throw error =
ValueError: Error when checking model input: the list of Numpy arrays that you are passing to your model is not the size the model expected. Expected to see 2 array(s), but instead got the following list of 1 arrays: [array([[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, ...
thanks for your great works for creating this code. really helped me a lot ๐
Here is the traceback:
Build model...
Traceback (most recent call last):
File "ram.py", line 117, in
model = RecurrentAttentionMemory()
File "ram.py", line 86, in init
x = shared_attention((memory, x))
File "/usr/local/lib/python3.6/site-packages/tensorflow/python/keras/_impl/keras/engine/base_layer.py", line 239, in call
output = super(Layer, self).call(inputs, **kwargs)
File "/usr/local/lib/python3.6/site-packages/tensorflow/python/layers/base.py", line 714, in call
outputs = self.call(inputs, *args, **kwargs)
File "/Users/tushar/workspace/python/impact/songyouwei/SA-DL/attention_layer.py", line 66, in call
score *= K.cast(mask, K.floatx())
File "/usr/local/lib/python3.6/site-packages/tensorflow/python/keras/_impl/keras/backend.py", line 1226, in cast
return math_ops.cast(x, dtype)
File "/usr/local/lib/python3.6/site-packages/tensorflow/python/ops/math_ops.py", line 779, in cast
x = ops.convert_to_tensor(x, name="x")
File "/usr/local/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 950, in convert_to_tensor
as_ref=False)
File "/usr/local/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1040, in internal_convert_to_tensor
ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
File "/usr/local/lib/python3.6/site-packages/tensorflow/python/ops/array_ops.py", line 1026, in _autopacking_conversion_function
return _autopacking_helper(v, inferred_dtype, name or "packed")
File "/usr/local/lib/python3.6/site-packages/tensorflow/python/ops/array_ops.py", line 988, in _autopacking_helper
constant_op.constant(elem, dtype=dtype, name=str(i)))
File "/usr/local/lib/python3.6/site-packages/tensorflow/python/framework/constant_op.py", line 214, in constant
value, dtype=dtype, shape=shape, verify_shape=verify_shape))
File "/usr/local/lib/python3.6/site-packages/tensorflow/python/framework/tensor_util.py", line 421, in make_tensor_proto
raise ValueError("None values not supported.")
ValueError: None values not supported.
Is there something that needs fixing?
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.