Pydantic 2.x cfg (#1239)

* WIP conversion to use pydantic for config validation

* wip, more fields, add capabilities

* wip

* update pydantic validation to match existing tests

* tweak requirements

* setup deprecated paams pydantic model

* more validations

* wrap up rest of the validations

* flesh out the rest of the options from the readme into pydantic

* fix model validators as class methods

remember to return in validator
missing return
add missing relora attributes
fix test for DictDefault change
fix sys template for mistral from fastchat change in PR 2872
fix test for batch size warning

* more missing attributes for cfg

* updates from PR feedback

* fix validation for datasets and pretrain datasets

* fix test for lora check
This commit is contained in:
Wing Lian
2024-02-26 12:24:14 -05:00
committed by GitHub
parent 5894f0e57e
commit cc3cebfa70
16 changed files with 1710 additions and 410 deletions

View File

@@ -39,7 +39,9 @@ class DictDefaultTest(unittest.TestCase):
), "DictDefault should support in operator for existing keys in list"
def test_dict_or_operator(self):
cfg = DictDefault(
cfg = DictDefault({"key_a": {"key_b": "value_b"}, "key_f": "value_g"})
cfg = cfg | DictDefault( # pylint: disable=unsupported-binary-operation
{
"key_a": {"key_b": "value_a"},
"key_c": "value_c",
@@ -48,10 +50,6 @@ class DictDefaultTest(unittest.TestCase):
}
)
cfg = cfg | DictDefault( # pylint: disable=unsupported-binary-operation
{"key_a": {"key_b": "value_b"}, "key_f": "value_g"}
)
assert (
cfg.key_a.key_b == "value_b"
), "DictDefault should support OR operator for existing nested keys"