Skip to content

Commit

Permalink
🥅 Disallow empty train streams
Browse files Browse the repository at this point in the history
Signed-off-by: Evaline Ju <[email protected]>
  • Loading branch information
evaline-ju committed Nov 2, 2023
1 parent e512728 commit 414fa1e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions caikit_nlp/modules/text_generation/peft_prompt_tuning.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,7 @@ def train(
PeftPromptTuning
Instance of this class with tuned prompt vectors.
"""
error.value_check("<NLP46653367E>", len(train_stream) > 0, "train_stream cannot be empty")

# Configure random seed
transformers.set_seed(seed)
Expand Down Expand Up @@ -388,6 +389,8 @@ def train(

train_stream = train_stream.map(convert_to_generation_record)
if val_stream:
error.value_check("<NLP63201425E>", len(val_stream) > 0, "val_stream cannot be empty")

val_stream = val_stream.map(convert_to_generation_record)

# Convert our datastreams -> data loaders by disguising them as PyTorch iterable datasets
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ def train(
TextGeneration
Instance of this class with fine-tuned models.
"""
error.value_check("<NLP96406893E>", len(train_stream) > 0, "train_stream cannot be empty")

torch_dtype = get_torch_dtype(torch_dtype)

Expand Down

0 comments on commit 414fa1e

Please sign in to comment.