# Trainer API weights initialization

**URL:** <https://discuss.huggingface.co/t/trainer-api-weights-initialization/139886>\
**Category:** 🤗Transformers\
**Created:** [February 9, 2025, 4:55pm UTC](https://discuss.huggingface.co/t/trainer-api-weights-initialization/139886 "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](https://discuss.huggingface.co/u/John6666)\
**Post date:** [February 10, 2025, 12:08pm UTC](https://discuss.huggingface.co/t/trainer-api-weights-initialization/139886/2 "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](https://discuss.huggingface.co/t/lazy-model-initialization/20933):
>
> 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](https://discuss.huggingface.co/t/trainer-api-weights-initialization/139886)._
