#681·mergekit

Pydantic error when merging models

Author: wmoell1Created Apr 19, 2026Updated May 26, 2026

The pydantic dependency listed, 2.10.6, generates the error below with mergekit 0.1.4. Text of error: 'pydantic.errors.PydanticUserError: ConfiguredModuleArchitecture is not fully defined; you should define torch, then call ConfiguredModuleArchitecture.model_rebuild().'

The error manifests during the merge planning phase when mergekit-yaml (or other mergekit entry points) attempts to load and analyze the model architectures before executing the merge graph. Specifically occurs in MergePlanner._out_module_arch().

I was able to workaround the error by modifying __init__py.file to import torch at the beginning and call the rebuild classes at the end: ConfiguredModuleArchitecture.model_rebuild() ConfiguredModelArchitecture.model_rebuild()

After making the above changes to init.py, mergekit was able to begin successfully executing the graph.

When I was researching how to resolve the conflict, I came across the issue on Pydantic's repo: https://github.com/pydantic/pydantic/issues/11004

This seems to suggest that mergekit needs to update its pydantic dependency possibly to avoid running into this error.