# Can we resize embedding with embedding weighted initialized differently?

**URL:** <https://discuss.huggingface.co/t/can-we-resize-embedding-with-embedding-weighted-initialized-differently/741>\
**Category:** 🤗Transformers\
**Created:** [August 18, 2020, 6:32am UTC](https://discuss.huggingface.co/t/can-we-resize-embedding-with-embedding-weighted-initialized-differently/741 "2020-08-18T06:32:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![xuxuxu](https://avatars.discourse-cdn.com/v4/letter/x/b19c9b/32.png) [@xuxuxu](https://discuss.huggingface.co/u/xuxuxu)\
**Post date:** [August 18, 2020, 6:32am UTC](https://discuss.huggingface.co/t/can-we-resize-embedding-with-embedding-weighted-initialized-differently/741/1 "2020-08-18T06:32:56Z")

</div>

When we add new tokens, this method automatically adds embedding using torch nn.Embedding.  
[https://huggingface.co/transformers/\_modules/transformers/modeling\_utils.html#PreTrainedModel.resize\_token\_embeddings](https://huggingface.co/transformers/_modules/transformers/modeling_utils.html#PreTrainedModel.resize_token_embeddings)

The documentation says the resized embeddings are nn. Embedding, which said they by default initialize weights from N(0, 1) ([https://pytorch.org/docs/stable/generated/torch.nn.Embedding.html](https://pytorch.org/docs/stable/generated/torch.nn.Embedding.html)). But I have checked that the resized embedding weights are almost N(0, 0.01) or N(0, 0.02)? Can I check **the true distribution of resized embedding weights**?

## If I want the embedding weights initialized differently, how can I achieve that efficiently?
