# Error loading custom model

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ferror-loading-custom-model%2F145212%3E%5C
**Category:** Beginners\
**Created:** [March 11, 2025, 12:28pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ferror-loading-custom-model%2F145212 "2025-03-11T12:28:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![varghesebabu](https://avatars.discourse-cdn.com/v4/letter/v/3d9bf3/32.png) [@varghesebabu](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fvarghesebabu)%5C
**Post date:** [March 11, 2025, 12:28pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ferror-loading-custom-model%2F145212%2F1 "2025-03-11T12:28:42Z")

</div>

I followed the guide here [Building custom models](https://huggingface.co/docs/transformers/en/custom_models) to share a custom pytorch model I trained.

Now when I try to load the model using from\_pretrained it gives me error.

`ValueError: The model class you are passing has a `config\_class` attribute that is not consistent with the config class you passed (model has <class 'reddit_comments_model.configuration_reddit_comments.ConfigRedditComments'> and you passed <class 'transformers_modules.varghesebabu.RedditComments2022.b3144afd5081ab4b5208c6b1d73b997ee8bcc9d6.configuration_reddit_comments.ConfigRedditComments'>. Fix one of those so they match!`

My config.json

`{ "architectures": ["RedditComments"], "auto_map": { "AutoConfig": "configuration_reddit_comments.ConfigRedditComments", "AutoModel": "modeling_reddit_comments.RedditComments" }, "embed_dim": 512, "model_type": "reddit_comments", "n_heads": 16, "num_layers": 16, "torch_dtype": "float32", "transformers_version": "4.48.1", "vocab_size": 50258 }`

What should I do?

EDIT : Looks like a bug in this version .

It works when I used with transformers version 4.40.2
