Skip to content

Commit

Permalink
add add assertion to build function of Llama
Browse files Browse the repository at this point in the history
  • Loading branch information
aakashapoorv committed May 21, 2024
1 parent 95d36c2 commit c4b2f5d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions llama/generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ def build(
This method initializes the distributed process group, sets the device to CUDA,
and loads the pre-trained model and tokenizer.
"""
assert 1 <= max_seq_len <= 8192, f"max_seq_len must be between 1 and 8192, got {max_seq_len}."
assert os.path.isdir(ckpt_dir), f"Checkpoint directory '{ckpt_dir}' does not exist."
assert os.path.isfile(tokenizer_path), f"Tokenizer file '{tokenizer_path}' does not exist."

if not torch.distributed.is_initialized():
torch.distributed.init_process_group("nccl")
if not model_parallel_is_initialized():
Expand Down

0 comments on commit c4b2f5d

Please sign in to comment.