-
-
Notifications
You must be signed in to change notification settings - Fork 920
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
convert exponential notation lr to floats (#771)
- Loading branch information
Showing
2 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
""" | ||
Test classes for checking functionality of the cfg normalization | ||
""" | ||
import unittest | ||
|
||
from axolotl.utils.config import normalize_config | ||
from axolotl.utils.dict import DictDefault | ||
|
||
|
||
class NormalizeConfigTestCase(unittest.TestCase): | ||
""" | ||
test class for normalize_config checks | ||
""" | ||
|
||
def _get_base_cfg(self): | ||
return DictDefault( | ||
{ | ||
"base_model": "JackFram/llama-68m", | ||
"base_model_config": "JackFram/llama-68m", | ||
"tokenizer_type": "LlamaTokenizer", | ||
"num_epochs": 1, | ||
"micro_batch_size": 1, | ||
"gradient_accumulation_steps": 1, | ||
} | ||
) | ||
|
||
def test_lr_as_float(self): | ||
cfg = ( | ||
self._get_base_cfg() | ||
| DictDefault( # pylint: disable=unsupported-binary-operation | ||
{ | ||
"learning_rate": "5e-5", | ||
} | ||
) | ||
) | ||
|
||
normalize_config(cfg) | ||
|
||
assert cfg.learning_rate == 0.00005 |