Skip to content

Commit

Permalink
move is_llama_derived_model into normalize_config (#524)
Browse files Browse the repository at this point in the history
  • Loading branch information
tmm1 authored Sep 4, 2023
1 parent cd48b85 commit e050495
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
11 changes: 1 addition & 10 deletions scripts/finetune.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from axolotl.utils.data import prepare_dataset
from axolotl.utils.dict import DictDefault
from axolotl.utils.distributed import is_main_process
from axolotl.utils.models import load_model_config, load_tokenizer
from axolotl.utils.models import load_tokenizer
from axolotl.utils.tokenization import check_dataset_labels
from axolotl.utils.wandb import setup_wandb_env_vars

Expand Down Expand Up @@ -216,15 +216,6 @@ def load_cfg(config: Path = Path("examples/"), **kwargs):
else:
cfg[k] = kwargs[k]

model_config = load_model_config(cfg)

# figure out if the model is llama
cfg.is_llama_derived_model = (
(hasattr(model_config, "model_type") and model_config.model_type == "llama")
or cfg.is_llama_derived_model
or "llama" in cfg.base_model
or (cfg.model_type and "llama" in cfg.model_type.lower())
)
validate_config(cfg)

normalize_config(cfg)
Expand Down
11 changes: 11 additions & 0 deletions src/axolotl/utils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import torch

from axolotl.utils.bench import log_gpu_memory_usage
from axolotl.utils.models import load_model_config

LOG = logging.getLogger("axolotl")

Expand Down Expand Up @@ -69,6 +70,16 @@ def normalize_config(cfg):
else:
cfg.torch_dtype = torch.float32

model_config = load_model_config(cfg)

# figure out if the model is llama
cfg.is_llama_derived_model = (
(hasattr(model_config, "model_type") and model_config.model_type == "llama")
or cfg.is_llama_derived_model
or "llama" in cfg.base_model
or (cfg.model_type and "llama" in cfg.model_type.lower())
)

log_gpu_memory_usage(LOG, "baseline", cfg.device)


Expand Down

0 comments on commit e050495

Please sign in to comment.