Chinese-Text-Classification-Pytorch icon indicating copy to clipboard operation
Chinese-Text-Classification-Pytorch copied to clipboard

网络结构中Model加载预训练词向量的疑问

Open hgsw opened this issue 11 months ago • 1 comments

if config.embedding_pretrained is not None: self.embedding = nn.Embedding.from_pretrained(config.embedding_pretrained, freeze=False)

这里的freeze=Fasle 不是很理解,难道说词向量需要随着训练过程进行参数更新? torch 2.0.1 版本是True 描述为不参数网络参数更新? Args: embeddings (Tensor): FloatTensor containing weights for the Embedding. First dimension is being passed to Embedding as num_embeddings, second as embedding_dim. freeze (bool, optional): If True, the tensor does not get updated in the learning process. Equivalent to embedding.weight.requires_grad = False. Default: True

hgsw avatar Mar 11 '24 02:03 hgsw