# Trainer API weights initialization

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ftrainer-api-weights-initialization%2F139886%3E%5C
**Category:** 🤗Transformers\
**Created:** [February 9, 2025, 4:55pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ftrainer-api-weights-initialization%2F139886 "2025-02-09T16:55:30Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FJohn6666)%5C
**Post date:** [February 10, 2025, 12:08pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ftrainer-api-weights-initialization%2F139886%2F2 "2025-02-10T12:08:34Z")

</div>

I think many people initialize with an empty weight or use from\_pretrained to bring in the initial values of the base model.

> [@Lazy model initialization](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Flazy-model-initialization%2F20933)%3A
>
> Hello. How can I create a model object and skip the random initialization of weights? The random initialization is time consuming and unnecessary for my case, as I want to load the weights using torch.load\_state\_dict. For instance, see the code below. config = BloomConfig.from\_pretrained("bigscience/bloom") block = BloomBlock(config) # initializes weights randomly, which is time consuming block.load\_state\_dict(torch.load("path\_to\_pytorch\_bin"))

---

_[View the full topic](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ftrainer-api-weights-initialization%2F139886)._
