rddy / deeptutor

Spaced repetition through deep reinforcement learning
MIT License
64 stars 7 forks source link

Some of the problems #1

Closed Eroslon closed 5 years ago

Eroslon commented 5 years ago

Hi, blogger, I am very glad to read your article, but I have some problems when running the code, I would like to ask you for help, the following picture is the problem I met, I look forward to your advice, thank you very much! image ![Uploading image.png…]() ![Uploading image.png…]()

rddy commented 5 years ago

Can you please post the original text of the error message? The screenshot doesn't contain the entire backtrace, so it's hard to tell what the issue is.

Eroslon commented 5 years ago

Ok, thank you very much. The error it prompts is:

TypeError Traceback (most recent call last)

in 11 if tutor_name.startswith('RL'): 12 agent = build_tutor(n_items) ---> 13 R[k, i, :, j] = agent.train(rl_env, n_eps=n_eps) 14 else: 15 if 'Thresh' in tutor_name: in train(self, gym_env, n_eps) 9 policy = CategoricalGRUPolicy( 10 env_spec=env.spec, hidden_dim=32, ---> 11 state_include_action=False) 12 self.raw_policy = LoggedTRPO( 13 env=env, E:\Anaconda\lib\site-packages\rllab\policies\categorical_gru_policy.py in __init__(self, env_spec, hidden_dim, feature_network, state_include_action, hidden_nonlinearity) 72 hidden_nonlinearity=hidden_nonlinearity, 73 output_nonlinearity=TT.nnet.softmax, ---> 74 name="prob_network" 75 ) 76 E:\Anaconda\lib\site-packages\rllab\core\network.py in __init__(self, input_shape, output_dim, hidden_dim, hidden_nonlinearity, output_nonlinearity, name, input_var, input_layer) 226 nonlinearity=output_nonlinearity, 227 W=l_output_flat.W, --> 228 b=l_output_flat.b, 229 ) 230 E:\Anaconda\lib\site-packages\lasagne\layers\dense.py in __init__(self, incoming, num_units, W, b, nonlinearity, **kwargs) 62 b=init.Constant(0.), nonlinearity=nonlinearities.rectify, 63 **kwargs): ---> 64 super(DenseLayer, self).__init__(incoming, **kwargs) 65 self.nonlinearity = (nonlinearities.identity if nonlinearity is None 66 else nonlinearity) E:\Anaconda\lib\site-packages\lasagne\layers\base.py in __init__(self, incoming, name) 42 self.params = OrderedDict() 43 ---> 44 if any(d is not None and d <= 0 for d in self.input_shape): 45 raise ValueError(( 46 "Cannot create Layer with a non-positive input_shape ": E:\Anaconda\lib\site-packages\lasagne\layers\base.py in (.0) 42 self.params = OrderedDict() 43 ---> 44 if any(d is not None and d <= 0 for d in self.input_shape): 45 raise ValueError(( 46 "Cannot create Layer with a non-positive input_shape " TypeError: '<=' not supported between instances of 'tuple' and 'int' The error comes from lasagne\layers\base.py, the specific part of the code is as follows: from collections import OrderedDict from .. import utils __all__ = [ "Layer", "MergeLayer", ] # Layer base class class Layer(object): """ The :class:`Layer` class represents a single layer of a neural network. It should be subclassed when implementing new types of layers. Because each layer can keep track of the layer(s) feeding into it, a network's output :class:`Layer` instance can double as a handle to the full network. """ def __init__(self, incoming, name=None): """ Instantiates the layer. Parameters ---------- incoming : a :class:`Layer` instance or a tuple The layer feeding into this layer, or the expected input shape. name : a string or None An optional name to attach to this layer. """ if isinstance(incoming, tuple): self.input_shape = incoming self.input_layer = None else: self.input_shape = incoming.output_shape self.input_layer = incoming self.name = name self.params = OrderedDict() if any(d is not None and d <= 0 for d in self.input_shape): raise ValueError(( "Cannot create Layer with a non-positive input_shape " "dimension. input_shape=%r, self.name=%r") % ( self.input_shape, self.name))
Eroslon commented 5 years ago

I'm very sorry for disturbing you again because the previous problem has not been solved. Do you have any solution? Thank you very much!

rddy commented 5 years ago

This could be an rllab version issue. Try using rllab 0.1.0