From 0c6bc9b28104e43cbe177fb905091730d0798fb9 Mon Sep 17 00:00:00 2001 From: evelynmitchell Date: Fri, 24 Nov 2023 08:01:33 -0700 Subject: [PATCH] black formatting --- swarms/models/anthropic.py | 6 +++-- swarms/models/dalle3.py | 36 -------------------------- swarms/models/huggingface.py | 32 ----------------------- swarms/models/ssd_1b.py | 37 +++------------------------ swarms/structs/flow.py | 10 +++----- swarms/structs/sequential_workflow.py | 8 +++--- 6 files changed, 14 insertions(+), 115 deletions(-) diff --git a/swarms/models/anthropic.py b/swarms/models/anthropic.py index 679a46d4..91073ed1 100644 --- a/swarms/models/anthropic.py +++ b/swarms/models/anthropic.py @@ -200,9 +200,11 @@ def build_extra_kwargs( if field_name in extra_kwargs: raise ValueError(f"Found {field_name} supplied twice.") if field_name not in all_required_field_names: - warnings.warn(f"""WARNING! {field_name} is not default parameter. + warnings.warn( + f"""WARNING! {field_name} is not default parameter. {field_name} was transferred to model_kwargs. - Please confirm that {field_name} is what you intended.""") + Please confirm that {field_name} is what you intended.""" + ) extra_kwargs[field_name] = values.pop(field_name) invalid_model_kwargs = all_required_field_names.intersection( diff --git a/swarms/models/dalle3.py b/swarms/models/dalle3.py index 42e7f87a..49ae2468 100644 --- a/swarms/models/dalle3.py +++ b/swarms/models/dalle3.py @@ -170,17 +170,9 @@ class Dalle3: # Handling exceptions and printing the errors details print( colored( - ( -<<<<<<< HEAD - f"Error running Dalle3: {error} try" - " optimizing your api key and or try again" -======= f"Error running Dalle3: {error} try optimizing your api" " key and or try again" ->>>>>>> 49c7b97c (code quality fixes: line length = 80) ), - "red", - ) ) raise error @@ -243,13 +235,8 @@ class Dalle3: print( colored( ( -<<<<<<< HEAD - f"Error running Dalle3: {error} try" - " optimizing your api key and or try again" -======= f"Error running Dalle3: {error} try optimizing your api" " key and or try again" ->>>>>>> 49c7b97c (code quality fixes: line length = 80) ), "red", ) @@ -333,41 +320,18 @@ class Dalle3: except Exception as error: print( colored( - ( -<<<<<<< HEAD - f"Error running Dalle3: {error} try" - " optimizing your api key and or try" - " again" -======= f"Error running Dalle3: {error} try optimizing" " your api key and or try again" ->>>>>>> 49c7b97c (code quality fixes: line length = 80) - ), - "red", - ) - ) - print( - colored( -<<<<<<< HEAD - ( - "Error running Dalle3:" - f" {error.http_status}" - ), "red", ) ) print( colored( - f"Error running Dalle3: {error.error}", - "red", - ) -======= f"Error running Dalle3: {error.http_status}", "red" ) ) print( colored(f"Error running Dalle3: {error.error}", "red") ->>>>>>> 49c7b97c (code quality fixes: line length = 80) ) raise error diff --git a/swarms/models/huggingface.py b/swarms/models/huggingface.py index 231c3b2b..5c01d0b2 100644 --- a/swarms/models/huggingface.py +++ b/swarms/models/huggingface.py @@ -189,15 +189,7 @@ class HuggingfaceLLM: # raise print( colored( -<<<<<<< HEAD - ( - "Failed to load the model and or the" - f" tokenizer: {e}" - ), - "red", -======= f"Failed to load the model and or the tokenizer: {e}", "red" ->>>>>>> 49c7b97c (code quality fixes: line length = 80) ) ) @@ -231,12 +223,7 @@ class HuggingfaceLLM: self.model = DDP(self.model) except Exception as error: self.logger.error( -<<<<<<< HEAD - "Failed to load the model or the tokenizer:" - f" {error}" -======= f"Failed to load the model or the tokenizer: {error}" ->>>>>>> 49c7b97c (code quality fixes: line length = 80) ) raise @@ -278,13 +265,9 @@ class HuggingfaceLLM: self.print_dashboard(task) try: -<<<<<<< HEAD - inputs = self.tokenizer.encode(task, return_tensors="pt") -======= inputs = self.tokenizer.encode(task, return_tensors="pt").to( self.device ) ->>>>>>> 49c7b97c (code quality fixes: line length = 80) # self.log.start() @@ -324,18 +307,9 @@ class HuggingfaceLLM: except Exception as e: print( colored( - ( -<<<<<<< HEAD - "HuggingfaceLLM could not generate text" - f" because of error: {e}, try optimizing your" - " arguments" -======= "HuggingfaceLLM could not generate text because of" f" error: {e}, try optimizing your arguments" ->>>>>>> 49c7b97c (code quality fixes: line length = 80) ), - "red", - ) ) raise @@ -357,15 +331,9 @@ class HuggingfaceLLM: self.print_dashboard(task) try: -<<<<<<< HEAD - inputs = self.tokenizer.encode( - task, return_tensors="pt" - ).to(self.device) -======= inputs = self.tokenizer.encode(task, return_tensors="pt").to( self.device ) ->>>>>>> 49c7b97c (code quality fixes: line length = 80) # self.log.start() diff --git a/swarms/models/ssd_1b.py b/swarms/models/ssd_1b.py index f9b0bb4a..ca1a5d32 100644 --- a/swarms/models/ssd_1b.py +++ b/swarms/models/ssd_1b.py @@ -144,18 +144,11 @@ class SSD1B: # Handling exceptions and printing the errors details print( colored( - ( -<<<<<<< HEAD - f"Error running SSD1B: {error} try optimizing" - " your api key and or try again" -======= f"Error running SSD1B: {error} try optimizing your api" " key and or try again" ->>>>>>> 49c7b97c (code quality fixes: line length = 80) - ), "red", ) - ) + ); raise error def _generate_image_name(self, task: str): @@ -239,41 +232,17 @@ class SSD1B: except Exception as error: print( colored( - ( -<<<<<<< HEAD - f"Error running SSD1B: {error} try" - " optimizing your api key and or try" - " again" -======= - f"Error running SSD1B: {error} try optimizing" - " your api key and or try again" ->>>>>>> 49c7b97c (code quality fixes: line length = 80) - ), + f"Error running SSD1B: {error} try optimizing" + " your api key and or try again", "red", ) ) print( colored( -<<<<<<< HEAD - ( - "Error running SSD1B:" - f" {error.http_status}" - ), - "red", - ) - ) - print( - colored( - f"Error running SSD1B: {error.error}", - "red", - ) - ) -======= f"Error running SSD1B: {error.http_status}", "red" ) ) print(colored(f"Error running SSD1B: {error.error}", "red")) ->>>>>>> 49c7b97c (code quality fixes: line length = 80) raise error def _generate_uuid(self): diff --git a/swarms/structs/flow.py b/swarms/structs/flow.py index 18a141a3..99a3e587 100644 --- a/swarms/structs/flow.py +++ b/swarms/structs/flow.py @@ -137,7 +137,7 @@ class Flow: """ Flow is the structure that provides autonomy to any llm in a reliable and effective fashion. The flow structure is designed to be used with any llm and provides the following features: - + Features: * Interactive, AI generates, then user input * Message history and performance history fed -> into context -> truncate if too long @@ -489,10 +489,8 @@ class Flow: except Exception as error: print( colored( - ( - "Error activating autonomous agent. Try optimizing your" - " parameters..." - ), + "Error activating autonomous agent. Try optimizing your" + " parameters...", "red", ) ) @@ -652,7 +650,7 @@ class Flow: while attempt < self.retry_attempts: try: response = self.llm( - task**kwargs, + task ** kwargs, ) if self.interactive: print(f"AI: {response}") diff --git a/swarms/structs/sequential_workflow.py b/swarms/structs/sequential_workflow.py index fc977909..0b368d65 100644 --- a/swarms/structs/sequential_workflow.py +++ b/swarms/structs/sequential_workflow.py @@ -533,11 +533,9 @@ class SequentialWorkflow: except Exception as e: print( colored( - ( - "Error initializing the Sequential workflow:" - f" {e} try optimizing your inputs like the" - " agent class and task description" - ), + f"Error initializing the Sequential workflow: {e} try" + " optimizing your inputs like the flow class and task" + " description", "red", attrs=["bold", "underline"], )