Skip to content
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

V2 API recurrent_group 不支持配置双层RNN? #2065

Closed
wanghaoshuang opened this issue May 9, 2017 · 1 comment
Closed

V2 API recurrent_group 不支持配置双层RNN? #2065

wanghaoshuang opened this issue May 9, 2017 · 1 comment

Comments

@wanghaoshuang
Copy link
Contributor

I got an err when i run a sequence_nest_rnn demo, which is translated from v1 demo sequence_nest_rnn.conf

my sequence_nest_rnn configuration:

import paddle.v2 as paddle

__all__ = ['nested_sequence_net']

def outer_step(x):
    outer_mem = paddle.layer.memory(name="outer_rnn_state", size=128)
    def inner_step(y):
        inner_mem = paddle.layer.memory(name="inner_rnn_state",
                size=128,
                boot_layer=outer_mem)
        #return resnet.residual_net(ipt=[y, inner_mem], depth=32)
        return paddle.layer.fc(input=[y, inner_mem],
                size=128,
                act=paddle.activation.Relu(),
                name="inner_rnn_state",
                bias_attr=None)
    inner_rnn_output = paddle.layer.recurrent_group(step=inner_step,
            input=x,
            name="inner")
    last = paddle.layer.last_seq(input=inner_rnn_output,
            name="outer_rnn_state")
    return inner_rnn_output

def nested_sequence_net(ipt):
    return paddle.layer.recurrent_group(step=outer_step, input=ipt)

and my data layer:

data = paddle.layer.data("word", paddle.data_type.integer_value_sub_sequence(dict_dim))
emb = paddle.layer.embedding(input=data, size=emb_dim)
net = nested_sequence_net(emb)

and err log:

finish load word_dict, word_dict dim: 5147
I0502 19:05:28.741672 10743 Util.cpp:166] commandline:  --use_gpu=False --trainer_count=1
Traceback (most recent call last):
  File "train.py", line 90, in <module>
    main()
  File "train.py", line 48, in main
    parameters = paddle.parameters.create(cost)
  File "/home/work/wanghaoshuang/workspace/paddle_dev/env/idl/paddle/output/python27-gcc482/lib/python2.7/site-packages/paddle/v2/parameters.py", line 19, in create
    topology = Topology(layers)
  File "/home/work/wanghaoshuang/workspace/paddle_dev/env/idl/paddle/output/python27-gcc482/lib/python2.7/site-packages/paddle/v2/topology.py", line 69, in __init__
    layers, extra_layers=extra_layers)
  File "/home/work/wanghaoshuang/workspace/paddle_dev/env/idl/paddle/output/python27-gcc482/lib/python2.7/site-packages/paddle/v2/layer.py", line 96, in parse_network
    return __parse__(__real_func__)
  File "/home/work/wanghaoshuang/workspace/paddle_dev/env/idl/paddle/output/python27-gcc482/lib/python2.7/site-packages/paddle/trainer_config_helpers/config_parser_utils.py", line 32, in parse_network_config
    config = config_parser.parse_config(network_conf, config_arg_str)
  File "/home/work/wanghaoshuang/workspace/paddle_dev/env/idl/paddle/output/python27-gcc482/lib/python2.7/site-packages/paddle/trainer/config_parser.py", line 3598, in parse_config
    trainer_config()
  File "/home/work/wanghaoshuang/workspace/paddle_dev/env/idl/paddle/output/python27-gcc482/lib/python2.7/site-packages/paddle/v2/layer.py", line 89, in __real_func__
    real_output = [each.to_proto(context=context) for each in output_layers]
  File "/home/work/wanghaoshuang/workspace/paddle_dev/env/idl/paddle/output/python27-gcc482/lib/python2.7/site-packages/paddle/v2/config_base.py", line 109, in to_proto
    context=context)
  File "/home/work/wanghaoshuang/workspace/paddle_dev/env/idl/paddle/output/python27-gcc482/lib/python2.7/site-packages/paddle/v2/config_base.py", line 109, in to_proto
    context=context)
  File "/home/work/wanghaoshuang/workspace/paddle_dev/env/idl/paddle/output/python27-gcc482/lib/python2.7/site-packages/paddle/v2/config_base.py", line 109, in to_proto
    context=context)
  File "/home/work/wanghaoshuang/workspace/paddle_dev/env/idl/paddle/output/python27-gcc482/lib/python2.7/site-packages/paddle/v2/config_base.py", line 112, in to_proto
    self.__parent_layers__[layer_name])
  File "/home/work/wanghaoshuang/workspace/paddle_dev/env/idl/paddle/output/python27-gcc482/lib/python2.7/site-packages/paddle/v2/config_base.py", line 111, in <lambda>
    v1_layer = map(lambda x: x.to_proto(context=context),
  File "/home/work/wanghaoshuang/workspace/paddle_dev/env/idl/paddle/output/python27-gcc482/lib/python2.7/site-packages/paddle/v2/config_base.py", line 112, in to_proto
    self.__parent_layers__[layer_name])
  File "/home/work/wanghaoshuang/workspace/paddle_dev/env/idl/paddle/output/python27-gcc482/lib/python2.7/site-packages/paddle/v2/config_base.py", line 111, in <lambda>
    v1_layer = map(lambda x: x.to_proto(context=context),
  File "/home/work/wanghaoshuang/workspace/paddle_dev/env/idl/paddle/output/python27-gcc482/lib/python2.7/site-packages/paddle/v2/config_base.py", line 112, in to_proto
    self.__parent_layers__[layer_name])
  File "/home/work/wanghaoshuang/workspace/paddle_dev/env/idl/paddle/output/python27-gcc482/lib/python2.7/site-packages/paddle/v2/config_base.py", line 111, in <lambda>
    v1_layer = map(lambda x: x.to_proto(context=context),
  File "/home/work/wanghaoshuang/workspace/paddle_dev/env/idl/paddle/output/python27-gcc482/lib/python2.7/site-packages/paddle/v2/config_base.py", line 100, in to_proto
    p.to_proto(context=context)
  File "/home/work/wanghaoshuang/workspace/paddle_dev/env/idl/paddle/output/python27-gcc482/lib/python2.7/site-packages/paddle/v2/config_base.py", line 116, in to_proto
    ret_val = self.to_proto_impl(**kwargs)
  File "/home/work/wanghaoshuang/workspace/paddle_dev/env/idl/paddle/output/python27-gcc482/lib/python2.7/site-packages/paddle/v2/layer.py", line 197, in to_proto_impl
    return conf_helps.memory(name=self.name, **args)
  File "/home/work/wanghaoshuang/workspace/paddle_dev/env/idl/paddle/output/python27-gcc482/lib/python2.7/site-packages/paddle/trainer_config_helpers/default_decorators.py", line 53, in __wrapper__
    return func(*args, **kwargs)
  File "/home/work/wanghaoshuang/workspace/paddle_dev/env/idl/paddle/output/python27-gcc482/lib/python2.7/site-packages/paddle/trainer_config_helpers/layers.py", line 2929, in memory
    memory_name=memory_name)
  File "/home/work/wanghaoshuang/workspace/paddle_dev/env/idl/paddle/output/python27-gcc482/lib/python2.7/site-packages/paddle/trainer/config_parser.py", line 2338, in Memory
    agent_layer = AgentLayer(agent_name, size)
  File "/home/work/wanghaoshuang/workspace/paddle_dev/env/idl/paddle/output/python27-gcc482/lib/python2.7/site-packages/paddle/trainer/config_parser.py", line 2244, in __init__
    name, 'agent', size, inputs=[], device=device)
  File "/home/work/wanghaoshuang/workspace/paddle_dev/env/idl/paddle/output/python27-gcc482/lib/python2.7/site-packages/paddle/trainer/config_parser.py", line 1441, in __init__
    height = self.get_input_layer(0).height
  File "/home/work/wanghaoshuang/workspace/paddle_dev/env/idl/paddle/output/python27-gcc482/lib/python2.7/site-packages/paddle/trainer/config_parser.py", line 1447, in get_input_layer
    return g_layer_map[self.config.inputs[input_index].input_layer_name]
  File "/home/work/wanghaoshuang/workspace/paddle_dev/env/idl/paddle/output/python27-gcc482/lib/python2.7/site-packages/google/protobuf/internal/containers.py", line 204, in __getitem__
    return self._values[key]
IndexError: list index out of range

在V1中,nested rnn的input需要用SubsequenceInput标记,但是在V2的recurrent_group里没有涉及SubsequenceInput的逻辑,而且没有处理subsequence的逻辑,是不是V2的recurrent_group暂不支持双层RNN?

@lcy-seso lcy-seso added the Bug label May 9, 2017
@luotao1 luotao1 added this to 已有BUG in V2 API Enhancement May 9, 2017
@luotao1 luotao1 moved this from 全局BUG to Recurrent Group相关BUG in V2 API Enhancement May 9, 2017
@lcy-seso lcy-seso added this to Top priorities in Defects board May 10, 2017
@lcy-seso lcy-seso moved this from Not in schedule to Next Week in Defects board May 10, 2017
@lcy-seso lcy-seso moved this from Next Week to Current Week ToDo in Defects board May 10, 2017
@lcy-seso lcy-seso moved this from Current Week ToDo to Not in schedule in Defects board May 10, 2017
@reyoung reyoung moved this from Not in schedule to Next Week in Defects board May 10, 2017
@reyoung reyoung moved this from Next Week to Not in schedule in Defects board May 10, 2017
@emailweixu emailweixu mentioned this issue May 26, 2017
@luotao1 luotao1 moved this from Recurrent Group相关BUG to BUG in V2 API Enhancement Jun 5, 2017
@lcy-seso lcy-seso moved this from Not in schedule to Doing in Defects board Jun 7, 2017
@lcy-seso lcy-seso moved this from Doing to Done in Defects board Jun 7, 2017
@lcy-seso lcy-seso moved this from BUG to 已完成 in V2 API Enhancement Jun 7, 2017
@lcy-seso
Copy link
Contributor

lcy-seso commented Jun 7, 2017

This problem has been fixed by this PR #2288.

Thank you for the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

4 participants