mosaicml / llm-foundry

LLM training code for Databricks foundation models
https://www.databricks.com/blog/introducing-dbrx-new-state-art-open-llm
Apache License 2.0
3.83k stars 502 forks source link

Avoid circular import in hf checkpointer #1304

Closed dakinggg closed 1 week ago

dakinggg commented 1 week ago

If you extend LLM Foundry modeling/config code, the hf checkpointer may create a circular import in its attempt to automatically add all the missing imports to the files for hf. This PR simply excludes the dangerous circular import by preventing either of the entrypoint files (the modeling file or the config file), from including an import to the modeling file. The modeling file is expected to include a legitimate import of the config file, but the config file should not import the modeling file as this would be circular.