TypeError:__ init __()得到了一个意外的关键字参数'重用'

时间:2017-04-20 02:20:23

标签: tensorflow ubuntu-14.04 syntaxnet

我尝试使用Python 2.7创建dragnn模型,当我使用wrapped_units.LayerNormBasicLSTMNetwork进行标记错误时,但是当使用FeedForwardNetwork时,程序运行良好,如下:

tagger = spec_builder.ComponentSpecBuilder('tagger')
tagger.set_network_unit(name='wrapped_units.LayerNormBasicLSTMNetwork',             hidden_layer_sizes='256')
tagger.set_transition_system(name='tagger')
tagger.add_rnn_link(embedding_dim=-1)
tagger.add_token_link(source=lookahead, fml='input.focus', embedding_dim=64)
tagger.fill_from_resources(DATA_DIR)

当我构建火车图时,

with graph.as_default():
    hyperparam_config = spec_pb2.GridPoint(
        learning_method='adam',
        learning_rate=0.0005, 
        adam_beta1=0.9, adam_beta2=0.9, adam_eps=0.001,
        decay_steps=128000,
        dropout_rate=0.8, gradient_clip_norm=1,
        use_moving_average=True,
        seed=1)    
    builder = graph_builder.MasterBuilder(master_spec, hyperparam_config)
    target = spec_pb2.TrainTarget(
        name='all',
        unroll_using_oracle=[False, True, True], # train tagger & parser on gold unrolling, skip lookahead
        component_weights=[0, 0.5, 0.5]) # tagger and parser losses have equal weights
    trainer = builder.add_training_from_config(target)
    annotator = builder.add_annotation(enable_tracing=True)
    builder.add_saver()

当我跑步时,错误发生

  

TypeErrorTraceback(最近一次调用最后一次)    in()       10 use_moving_average = True,       11种子= 1)
  ---> 12 builder = graph_builder.MasterBuilder(master_spec,> hyperparam_config)       13 target = spec_pb2.TrainTarget(       14 name =' all',

     

/usr/local/lib/python2.7/dist-packages/dragnn/python/graph_builder.pyc in> init (self,master_spec,hyperparam_config,pool_scope)     173#如果找不到则引发ValueError。      174 comp = component.ComponentBuilderBase.Create(component_type,> self,    - > 175 component_spec)      176      177 self.lookup_component [comp.name] = comp

     

/usr/local/lib/python2.7/dist-packages/syntaxnet/util/registry.pyc in> Create(subclass_name,* args,** kwargs)      180"""围绕_Create()的包装器,用于讨论|基类|。"""      181 path = inspect.getmodule(baseclass)。 name    - > 182 return _ResolveAndCreate(baseclass,path,subclass_name,* args,> ** kwargs)      183     184 baseclass.Create = staticmethod(Create)

     

/usr/local/lib/python2.7/dist-packages/syntaxnet/util/registry.pyc in> _ResolveAndCreate(baseclass,path,subclass_name,* args,** kwargs)      164而True:      165 resolved_subclass_name ='。' .join(elements + [subclass_name])    - > 166 subclass = _Create(baseclass,resolved_subclass_name,* args,> ** kwargs)      167 if subclass:return subclass#success      168若不是元素:中断#不再需要尝试的路径

     

/usr/local/lib/python2.7/dist-packages/syntaxnet/util/registry.pyc in> _Create(baseclass,subclass_name,* args,** kwargs)      129 baseclass。 name )      130返回无    - > 131返回子类(* args,** kwargs)      132      133

     > init 中的 /usr/lib/python2.7/dist-packages/dragnn/python/component.pyc(self,master,component_spec,attr_defaults)      114      115#构造网络变量。    - > 116 self.network = self.make_network(self.spec.network_unit)      117      118#构建移动平均线。

     

/usr/local/lib/python2.7/dist-packages/dragnn/python/component.pyc in> make_network(self,network_unit)      141与tf.variable_scope(self.name):      142#如果找不到则引发ValueError。    - > 143返回network_units.NetworkUnitInterface.Create(network_type,> self)      144      145 @abstractmethod

     

/usr/local/lib/python2.7/dist-packages/syntaxnet/util/registry.pyc in> Create(subclass_name,* args,** kwargs)      180"""围绕_Create()的包装器,用于讨论|基类|。"""      181 path = inspect.getmodule(baseclass)。 name    - > 182 return _ResolveAndCreate(baseclass,path,subclass_name,* args,> ** kwargs)      183      184 baseclass.Create = staticmethod(Create)

     

/usr/local/lib/python2.7/dist-packages/syntaxnet/util/registry.pyc in> _ResolveAndCreate(baseclass,path,subclass_name,* args,** kwargs)      164而True:      165 resolved_subclass_name ='。' .join(elements + [subclass_name])    - > 166 subclass = _Create(baseclass,resolved_subclass_name,* args,> ** kwargs)      167 if subclass:return subclass#success      168若不是元素:中断#不再需要尝试的路径

     

/usr/local/lib/python2.7/dist-packages/syntaxnet/util/registry.pyc in> _Create(baseclass,subclass_name,* args,** kwargs)      129 baseclass。 name )      130返回无    - > 131返回子类(* args,** kwargs)      132      133

     

/usr/local/lib/python2.7/dist-packages/dragnn/python/wrapped_units.pyc in> init (self,component)      238 self._train_cell => tf.contrib.rnn.MultiRNNCell(self._create_train_cells())      239 self._inference_cell = tf.contrib.rnn.MultiRNNCell(    - > 240 self._create_inference_cells())      241      242 def _cell_closure(范围):

     

/usr/local/lib/python2.7/dist-packages/dragnn/python/wrapped_units.pyc in> _create_inference_cells(self)     176返回[      177 self._create_cell(num_units,during_training = False)    - > 178为self._hidden_​​layer_sizes中的num_units      179]      180

     

/usr/local/lib/python2.7/dist-packages/dragnn/python/wrapped_units.pyc in> _create_cell(self,num_units,during_training)      154如果不是在训练期间:      155返回tf.contrib.rnn.LayerNormBasicLSTMCell(    - > 156 num_units,layer_norm = self._attrs [' layer_norm'],> reuse = True)      157      158#否则,将dropout应用于输入和重复。

     

TypeError: init ()得到了一个意外的关键字参数'重用'

0 个答案:

没有答案