mirror of
				https://github.com/explosion/spaCy.git
				synced 2025-11-04 09:57:26 +03:00 
			
		
		
		
	Pass settings better from parser
This commit is contained in:
		
							parent
							
								
									ab7f85dfa2
								
							
						
					
					
						commit
						1dce86c555
					
				| 
						 | 
					@ -57,6 +57,7 @@ cdef class Parser:
 | 
				
			||||||
                            cfg.get('subword_features', True))
 | 
					                            cfg.get('subword_features', True))
 | 
				
			||||||
        conv_depth = util.env_opt('conv_depth', cfg.get('conv_depth', 4))
 | 
					        conv_depth = util.env_opt('conv_depth', cfg.get('conv_depth', 4))
 | 
				
			||||||
        conv_window = util.env_opt('conv_window', cfg.get('conv_depth', 1))
 | 
					        conv_window = util.env_opt('conv_window', cfg.get('conv_depth', 1))
 | 
				
			||||||
 | 
					        t2v_pieces = util.env_opt('cnn_maxout_pieces', cfg.get('cnn_maxout_pieces', 3))
 | 
				
			||||||
        bilstm_depth = util.env_opt('bilstm_depth', cfg.get('bilstm_depth', 0))
 | 
					        bilstm_depth = util.env_opt('bilstm_depth', cfg.get('bilstm_depth', 0))
 | 
				
			||||||
        self_attn_depth = util.env_opt('self_attn_depth', cfg.get('self_attn_depth', 0))
 | 
					        self_attn_depth = util.env_opt('self_attn_depth', cfg.get('self_attn_depth', 0))
 | 
				
			||||||
        if depth not in (0, 1):
 | 
					        if depth not in (0, 1):
 | 
				
			||||||
| 
						 | 
					@ -73,6 +74,7 @@ cdef class Parser:
 | 
				
			||||||
        tok2vec = Tok2Vec(token_vector_width, embed_size,
 | 
					        tok2vec = Tok2Vec(token_vector_width, embed_size,
 | 
				
			||||||
                          conv_depth=conv_depth,
 | 
					                          conv_depth=conv_depth,
 | 
				
			||||||
                          conv_window=conv_window,
 | 
					                          conv_window=conv_window,
 | 
				
			||||||
 | 
					                          cnn_maxout_pieces=t2v_pieces,
 | 
				
			||||||
                          subword_features=subword_features,
 | 
					                          subword_features=subword_features,
 | 
				
			||||||
                          pretrained_vectors=pretrained_vectors,
 | 
					                          pretrained_vectors=pretrained_vectors,
 | 
				
			||||||
                          bilstm_depth=bilstm_depth,
 | 
					                          bilstm_depth=bilstm_depth,
 | 
				
			||||||
| 
						 | 
					@ -101,7 +103,8 @@ cdef class Parser:
 | 
				
			||||||
            'self_attn_depth': self_attn_depth,
 | 
					            'self_attn_depth': self_attn_depth,
 | 
				
			||||||
            'conv_depth': conv_depth,
 | 
					            'conv_depth': conv_depth,
 | 
				
			||||||
            'conv_window': conv_window,
 | 
					            'conv_window': conv_window,
 | 
				
			||||||
            'embed_size': embed_size
 | 
					            'embed_size': embed_size,
 | 
				
			||||||
 | 
					            'cnn_maxout_pieces': t2v_pieces
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        return ParserModel(tok2vec, lower, upper), cfg
 | 
					        return ParserModel(tok2vec, lower, upper), cfg
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user