Skip to content

Commit 485a268

Browse files
GregoryComermalfet
authored andcommitted
Recognize instruct models as chat (#449)
1 parent 3fb4b76 commit 485a268

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

build/builder.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def from_args(cls, args): # -> BuilderArgs:
9494
is_chat_model = True
9595
else:
9696
for path in [
97-
args.checkpoint_path,
97+
checkpoint_path,
9898
checkpoint_dir,
9999
args.dso_path,
100100
args.pte_path,
@@ -104,8 +104,11 @@ def from_args(cls, args): # -> BuilderArgs:
104104
path = str(path)
105105
if path.endswith("/"):
106106
path = path[:-1]
107-
path_basename = os.path.basename(path)
108-
if "chat" in path_basename:
107+
if os.path.isfile(path):
108+
path = os.path.dirname(path)
109+
110+
path_basename = os.path.basename(path).lower()
111+
if "chat" in path_basename or "instruct" in path_basename:
109112
is_chat_model = True
110113

111114
return cls(
@@ -222,7 +225,7 @@ def from_args(cls, args): # -> TokenizerArgs:
222225
t=None,
223226
)
224227

225-
228+
226229
def _initialize_tokenizer(tokenizer_args: TokenizerArgs):
227230
return tokenizer_args.t
228231

0 commit comments

Comments
 (0)