Skip to content

Commit

Permalink
Merge pull request #416 from abhi1092/main
Browse files Browse the repository at this point in the history
Using AutoConfig to load model config file.
  • Loading branch information
JamesKunstle authored Feb 4, 2025
2 parents 9b92401 + 4bd604d commit 89c5bd5
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/instructlab/training/main_ds.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from copy import deepcopy
from pathlib import Path
import argparse
import json
import math
import os
import re
Expand Down Expand Up @@ -40,7 +39,7 @@
from instructlab.dolomite.hf_models import GPTDolomiteForCausalLM
from torch.utils.data import DataLoader
from tqdm import tqdm
from transformers import AutoModelForCausalLM, get_scheduler
from transformers import AutoConfig, AutoModelForCausalLM, get_scheduler
import torch
import torch.distributed

Expand Down Expand Up @@ -538,9 +537,8 @@ def main(args):
tokenizer = setup_tokenizer(args.model_name_or_path, SPECIAL_TOKENS, CHAT_TEMPLATE)
# device = torch.device("cuda", args.local_rank)

with open(Path(args.model_name_or_path) / "config.json") as conf_json:
model_conf = json.load(conf_json)
args.model_type = model_conf["model_type"]
model_conf = AutoConfig.from_pretrained(args.model_name_or_path)
args.model_type = model_conf.model_type

#### distributed init #####
torch.cuda.set_device(int(os.environ["LOCAL_RANK"]))
Expand Down

0 comments on commit 89c5bd5

Please sign in to comment.