mirror of
https://github.com/rasbt/LLMs-from-scratch.git
synced 2026-04-10 12:33:42 +00:00
User argpars utils to show default args on command line
This commit is contained in:
@@ -253,16 +253,16 @@ def main(gpt_config, input_prompt, model_size, device):
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
parser = argparse.ArgumentParser(description="Generate text with a pretrained GPT-2 model.")
|
||||
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter, description="Generate text with a pretrained GPT-2 model.")
|
||||
parser.add_argument(
|
||||
"--prompt",
|
||||
default="Every effort moves you",
|
||||
help="Prompt text used to seed the generation (default matches the script's built-in prompt)."
|
||||
help="Prompt text used to seed the generation."
|
||||
)
|
||||
parser.add_argument(
|
||||
"--device",
|
||||
default="cpu",
|
||||
help="Device for running inference, e.g., cpu, cuda, mps, or auto. Defaults to cpu."
|
||||
help="Device for running inference, e.g., cpu, cuda, mps, or auto."
|
||||
)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
@@ -66,7 +66,7 @@ def combine_files(file_paths, target_dir, max_size_mb=500, separator="<|endoftex
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
parser = argparse.ArgumentParser(description="Preprocess and combine text files for pretraining")
|
||||
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter, description="Preprocess and combine text files for pretraining")
|
||||
|
||||
parser.add_argument("--data_dir", type=str, default="gutenberg/data/raw",
|
||||
help="Directory containing the downloaded raw training data")
|
||||
|
||||
@@ -148,7 +148,7 @@ def train_model_simple(model, optimizer, device, n_epochs,
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
parser = argparse.ArgumentParser(description="GPT Model Training Configuration")
|
||||
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter, description="GPT Model Training Configuration")
|
||||
|
||||
parser.add_argument("--data_dir", type=str, default="gutenberg/data",
|
||||
help="Directory containing the training data")
|
||||
|
||||
Reference in New Issue
Block a user