in src/autotrain/cli/run_llm.py [0:0]
def __init__(self, args):
self.args = args
store_true_arg_names = [
"train",
"deploy",
"inference",
"add_eos_token",
"peft",
"auto_find_batch_size",
"push_to_hub",
"merge_adapter",
"use_flash_attention_2",
"disable_gradient_checkpointing",
]
for arg_name in store_true_arg_names:
if getattr(self.args, arg_name) is None:
setattr(self.args, arg_name, False)
block_size_split = self.args.block_size.strip().split(",")
if len(block_size_split) == 1:
self.args.block_size = int(block_size_split[0])
elif len(block_size_split) > 1:
self.args.block_size = [int(x.strip()) for x in block_size_split]
else:
raise ValueError("Invalid block size")
if self.args.train:
if self.args.project_name is None:
raise ValueError("Project name must be specified")
if self.args.data_path is None:
raise ValueError("Data path must be specified")
if self.args.model is None:
raise ValueError("Model must be specified")
if self.args.push_to_hub:
# must have project_name, username and token OR project_name, token
if self.args.username is None:
raise ValueError("Usernamemust be specified for push to hub")
if self.args.token is None:
raise ValueError("Token must be specified for push to hub")
if self.args.backend.startswith("spaces") or self.args.backend.startswith("ep-"):
if not self.args.push_to_hub:
raise ValueError("Push to hub must be specified for spaces backend")
if self.args.username is None:
raise ValueError("Username must be specified for spaces backend")
if self.args.token is None:
raise ValueError("Token must be specified for spaces backend")
if self.args.deploy:
raise NotImplementedError("Deploy is not implemented yet")
if self.args.inference:
raise NotImplementedError("Inference is not implemented yet")