models.py -> loaders/ module refactor (#2680)

* models.py -> loaders/ module refactor

* refactor ModelLoader class

* plugin manager changes

* circular import fix

* pytest

* pytest

* minor improvements

* fix

* minor changes

* fix test

* remove dead code

* coderabbit comments

* lint

* fix

* coderabbit suggestion I liked

* more coderabbit

* review comments, yak shaving

* lint

* updating in light of SP ctx manager changes

* review comment

* review comment 2
This commit is contained in:
Dan Saunders
2025-05-23 15:51:11 -04:00
committed by GitHub
parent 8cde256db2
commit b5f1e53a0f
33 changed files with 2249 additions and 2039 deletions

View File

@@ -9,11 +9,11 @@ from typing import Optional
import pytest
from pydantic import ValidationError
from axolotl.loaders.utils import check_model_config
from axolotl.utils import is_comet_available
from axolotl.utils.config import validate_config
from axolotl.utils.dict import DictDefault
from axolotl.utils.mlflow_ import setup_mlflow_env_vars
from axolotl.utils.models import check_model_config
from axolotl.utils.schemas.config import AxolotlConfigWCapabilities
from axolotl.utils.wandb_ import setup_wandb_env_vars
@@ -1215,6 +1215,20 @@ class TestValidation(BaseValidation):
cfg, capabilities=capabilities, env_capabilities=env_capabilities
)
def test_cfg_throws_error_with_s2_attention_and_sample_packing(self, minimal_cfg):
test_cfg = DictDefault(
{
"s2_attention": True,
"sample_packing": True,
}
| minimal_cfg
)
with pytest.raises(
ValidationError,
match=r".*shifted-sparse attention does not currently support sample packing*",
):
validate_config(test_cfg)
class TestTorchCompileValidation(BaseValidation):
"""