-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ValueError: ('Unrecognized keyword arguments:', dict_keys(['input_dtype'])) #28
Comments
Hmm, not sure. The first thing I'd check is if the version of Theano is exactly the same as specified in the requirements.txt file. |
The version of Theano is the same as specified in requirements i.e. (1.0.4) |
Also, can you double check that backend in Keras is set to Theano, not TensorFlow? See how we do it in demo.py or check this tutorial. |
Yes, the backend is set to Theano as done in demo.py |
@inder9999 I'm running out of ideas. Did you try to google the error? |
@nikicc did you find any way ? |
@inder9999 sorry, no 😞 |
I am facing the same problem... |
I resolved it by using python 3.7 with venv |
sorry, how do you resolved this issue? i have the same problem with python 3.8 |
@davideiov what I suggest you to check these first:
|
@nikicc can u tell me pls the version of tensorflow used for model's training? because it isn't in the requirements file |
@davideiov the models do not work with Tensorflow (this is why it's not in the requirements file) but with Theano==1.0.4. Check how we set the backend in demo.py or check this tutorial. |
Hey guys. Thanks to @assemzh 's report, I have discovered you need to start with a clean Python virtual environment with Python 3.7 and then install the dependencies with
Solves my problems. Thanks @nikicc for sharing! Is it possible to upgrade the dependencies as many of them are quite outdated? |
Happy to hear this!
That would be quite a challenge. I'll think about it, but I don't promise anything. |
2 similar comments
Happy to hear this!
That would be quite a challenge. I'll think about it, but I don't promise anything. |
Happy to hear this!
That would be quite a challenge. I'll think about it, but I don't promise anything. |
Hey, I tried installing the requirements but still, it's not working. Anyone can suggest anything i need urgent help. |
@ArkajyotiChakraborty a likely cause for this is the wrong version of dependencies, or wrong Keras backend. I'd check these two:
If it's not that, I'm not sure what is causing this 🤔 |
TypeError Traceback (most recent call last)
in ()
----> 1 model = EmotionPredictor(classification='ekman', setting='mc')
20 frames
/content/drive/MyDrive/emotion_models/twitter-emotion-recognition-master_2/twitter-emotion-recognition/emotion_predictor.py in init(self, classification, setting, use_unison_model)
28 self.setting = setting
29 self.use_unison_model = use_unison_model
---> 30 self.model = self._get_model()
31 self.embeddings_model = self._get_embeddings_model()
32 self.char_to_ind = self._get_char_mapping()
/content/drive/MyDrive/emotion_models/twitter-emotion-recognition-master_2/twitter-emotion-recognition/emotion_predictor.py in _get_model(self)
40 self.setting,
41 )
---> 42 return load_model(self._loaded_model_filename)
43
44 def _get_embeddings_model(self):
/usr/local/lib/python3.7/dist-packages/keras/models.py in load_model(filepath, custom_objects)
126 raise ValueError('No model found in config file.')
127 model_config = json.loads(model_config.decode('utf-8'))
--> 128 model = model_from_config(model_config, custom_objects=custom_objects)
129
130 # set weights
/usr/local/lib/python3.7/dist-packages/keras/models.py in model_from_config(config, custom_objects)
175 raise Exception('
model_fom_config
expects a dictionary, not a list. '176 'Maybe you meant to use
Sequential.from_config(config)
?')--> 177 return layer_from_config(config, custom_objects=custom_objects)
178
179
/usr/local/lib/python3.7/dist-packages/keras/utils/layer_utils.py in layer_from_config(config, custom_objects)
34 layer_class = get_from_module(class_name, globals(), 'layer',
35 instantiate=False)
---> 36 return layer_class.from_config(config['config'])
37
38
/usr/local/lib/python3.7/dist-packages/keras/engine/topology.py in from_config(cls, config, custom_objects)
2373
2374 for layer_data in config['layers']:
-> 2375 process_layer(layer_data)
2376
2377 name = config.get('name')
/usr/local/lib/python3.7/dist-packages/keras/engine/topology.py in process_layer(layer_data)
2368 if input_tensors:
2369 if len(input_tensors) == 1:
-> 2370 layer(input_tensors[0])
2371 else:
2372 layer(input_tensors)
/usr/local/lib/python3.7/dist-packages/keras/engine/topology.py in call(self, x, mask)
512 if inbound_layers:
513 # this will call layer.build() if necessary
--> 514 self.add_inbound_node(inbound_layers, node_indices, tensor_indices)
515 input_added = True
516
/usr/local/lib/python3.7/dist-packages/keras/engine/topology.py in add_inbound_node(self, inbound_layers, node_indices, tensor_indices)
570 # creating the node automatically updates self.inbound_nodes
571 # as well as outbound_nodes on inbound layers.
--> 572 Node.create_node(self, inbound_layers, node_indices, tensor_indices)
573
574 def get_output_shape_for(self, input_shape):
/usr/local/lib/python3.7/dist-packages/keras/engine/topology.py in create_node(cls, outbound_layer, inbound_layers, node_indices, tensor_indices)
147
148 if len(input_tensors) == 1:
--> 149 output_tensors = to_list(outbound_layer.call(input_tensors[0], mask=input_masks[0]))
150 output_masks = to_list(outbound_layer.compute_mask(input_tensors[0], input_masks[0]))
151 # TODO: try to auto-infer shape if exception is raised by get_output_shape_for
/usr/local/lib/python3.7/dist-packages/keras/layers/core.py in call(self, x, mask)
88 if 0. < self.p < 1.:
89 noise_shape = self._get_noise_shape(x)
---> 90 x = K.in_train_phase(K.dropout(x, self.p, noise_shape), x)
91 return x
92
/usr/local/lib/python3.7/dist-packages/keras/backend/theano_backend.py in dropout(x, level, noise_shape, seed)
1014
1015 if noise_shape is None:
-> 1016 random_tensor = rng.binomial(x.shape, p=retain_prob, dtype=x.dtype)
1017 else:
1018 random_tensor = rng.binomial(noise_shape, p=retain_prob, dtype=x.dtype)
/usr/local/lib/python3.7/dist-packages/theano/sandbox/rng_mrg.py in binomial(self, size, n, p, ndim, dtype, nstreams, **kwargs)
899 if n == 1:
900 p = undefined_grad(as_tensor_variable(p))
--> 901 x = self.uniform(size=size, nstreams=nstreams, **kwargs)
902 return cast(x < p, dtype)
903 else:
/usr/local/lib/python3.7/dist-packages/theano/sandbox/rng_mrg.py in uniform(self, size, low, high, ndim, dtype, nstreams, **kwargs)
870 if nstreams is None:
871 nstreams = self.n_streams(size)
--> 872 rstates = self.get_substream_rstates(nstreams, dtype)
873
874 d = {}
/usr/local/lib/python3.7/dist-packages/theano/configparser.py in res(*args, **kwargs)
115 def res(*args, **kwargs):
116 with self:
--> 117 return f(*args, **kwargs)
118 return res
119
/usr/local/lib/python3.7/dist-packages/theano/sandbox/rng_mrg.py in get_substream_rstates(self, n_streams, dtype, inc_rstate)
777 # If multMatVect.dot_modulo isn't compiled, compile it.
778 if multMatVect.dot_modulo is None:
--> 779 multMatVect(rval[0], A1p72, M1, A2p72, M2)
780
781 # This way of calling the Theano fct is done to bypass Theano overhead.
/usr/local/lib/python3.7/dist-packages/theano/sandbox/rng_mrg.py in multMatVect(v, A, m1, B, m2)
60 o = DotModulo()(A_sym, s_sym, m_sym, A2_sym, s2_sym, m2_sym)
61 multMatVect.dot_modulo = function(
---> 62 [A_sym, s_sym, m_sym, A2_sym, s2_sym, m2_sym], o, profile=False)
63
64 # This way of calling the Theano fct is done to bypass Theano overhead.
/usr/local/lib/python3.7/dist-packages/theano/compile/function/init.py in function(inputs, outputs, mode, updates, givens, no_default_updates, accept_inplace, name, rebuild_strict, allow_input_downcast, profile, on_unused_input)
348 on_unused_input=on_unused_input,
349 profile=profile,
--> 350 output_keys=output_keys,
351 )
352 return fn
/usr/local/lib/python3.7/dist-packages/theano/compile/function/pfunc.py in pfunc(params, outputs, mode, updates, givens, no_default_updates, accept_inplace, name, rebuild_strict, allow_input_downcast, profile, on_unused_input, output_keys)
425 # transform params into theano.compile.In objects.
426 inputs = [
--> 427 _pfunc_param_to_in(p, allow_downcast=allow_input_downcast) for p in params
428 ]
429
/usr/local/lib/python3.7/dist-packages/theano/compile/function/pfunc.py in (.0)
425 # transform params into theano.compile.In objects.
426 inputs = [
--> 427 _pfunc_param_to_in(p, allow_downcast=allow_input_downcast) for p in params
428 ]
429
/usr/local/lib/python3.7/dist-packages/theano/compile/function/pfunc.py in _pfunc_param_to_in(param, strict, allow_downcast)
541 elif isinstance(param, In):
542 return param
--> 543 raise TypeError(f"Unknown parameter type: {type(param)}")
544
545
TypeError: Unknown parameter type: <class 'theano.tensor.var.TensorVariable'>
The text was updated successfully, but these errors were encountered: