From 5cd7cc08c4ff46019b491064fa965dc4c25ff915 Mon Sep 17 00:00:00 2001 From: mertyg Date: Mon, 15 Jul 2024 06:26:45 -0700 Subject: [PATCH] hotfix: prompt-optimization breaking changes after multimodal merge --- textgrad/tasks/base.py | 5 +---- textgrad/variable.py | 4 +++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/textgrad/tasks/base.py b/textgrad/tasks/base.py index 059473e..b71082d 100644 --- a/textgrad/tasks/base.py +++ b/textgrad/tasks/base.py @@ -13,10 +13,7 @@ def __getitem__(self): @abstractmethod def __len__(self): pass - - @abstractmethod - def get_default_task_instruction(self): - pass + class DataLoader: def __init__(self, data, batch_size=32, shuffle=True): diff --git a/textgrad/variable.py b/textgrad/variable.py index eeb997e..01b9020 100644 --- a/textgrad/variable.py +++ b/textgrad/variable.py @@ -40,7 +40,9 @@ def __init__( raise Exception("If the variable does not require grad, none of its predecessors should require grad." f"In this case, following predecessors require grad: {_predecessor_requires_grad}") - assert type(value) in [str, bytes], "Value must be a string or image (bytes)." + assert type(value) in [str, bytes, int], "Value must be a string, int, or image (bytes). Got: {}".format(type(value)) + if isinstance(value, int): + value = str(value) # We'll currently let "empty variables" slide, but we'll need to handle this better in the future. # if value == "" and image_path == "": # raise ValueError("Please provide a value or an image path for the variable")