Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions src/instructlab/training/main_ds.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,15 +182,9 @@ def setup_model(args, tokenizer, train_loader, grad_accum, flash_enabled):
)
model.config.eos_token_id = tokenizer.eos_token_id

assert model.__class__.__name__ in [
"MistralForCausalLM",
"GPTDolomiteForCausalLM",
"LlamaForCausalLM",
"Starcoder2ForCausalLM",
"GemmaForCausalLM",
"MixtralForCausalLM",
"GraniteForCausalLM",
], f"Model class name: {model.__class__.__name__} is not supported."
assert (
"ForCausalLM" in model.__class__.__name__

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we had a reason for this restriction, but I think it will be fine to lift this and revisit if it ever reappears.

), f"Model class name: {model.__class__.__name__} is not supported."

model = convert_loss_to_reduce_sum(model, use_dolomite=args.use_dolomite)
model = add_noisy_embeddings(model, noise_alpha=args.NEFTune_alpha)
Expand Down
9 changes: 6 additions & 3 deletions src/instructlab/training/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ def check_valid_train_args(train_args: TrainingArgs):
raise FileNotFoundError(
"Model path does not appear to be a directory. Please make sure that you're passing a Hugging Face Transformers compatible directory checkpoint."
)
else:
elif not len(train_args.model_path.split("/")) == 2:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if I pass gpt-2?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated error message to make expected input more clear

raise FileNotFoundError(
f"Provided path to model does not exist. Please make sure that you've passed a valid model and that it has appropriate permissions: {train_args.model_path}"
f"Provided path does not exist locally and is not an HF format name. Please make sure that you've passed a valid model path and that it has appropriate permissions, or a Huggingface model name (org/repo): {train_args.model_path}"
)

if train_args.use_dolomite and train_args.disable_flash_attn:
Expand Down Expand Up @@ -163,7 +163,10 @@ def listen(self):
while True:
byte = self.stdout.read(1)
if byte:
sys.stdout.buffer.write(byte)
if buffer := getattr(sys.stdout, "buffer", None):
buffer.write(byte)
else:
sys.stdout.write(byte.decode("utf-8", "ignore"))
sys.stdout.flush()
full_log_file.write(byte)
else:
Expand Down