From 7f5c87213a4a690df7894194b734f0829c3c9a98 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 9 Jun 2024 01:02:04 +0200 Subject: [PATCH] removed classifier approach --- blowtorch/__init__.py | 51 ------------------------------------------- 1 file changed, 51 deletions(-) diff --git a/blowtorch/__init__.py b/blowtorch/__init__.py index b4d22d6..08a1402 100644 --- a/blowtorch/__init__.py +++ b/blowtorch/__init__.py @@ -879,57 +879,6 @@ def vramUsage (self) -> tuple[float, str]: return (vram_usage, suffix[ind]) -class classifier: - - def __init__(self, client: client, attribute: str, scale: tuple|None=None, classes: list|None=None, max_new_tokens: int=5) -> None: - - self.client = client - self.attribute = attribute - self.classes = classes - self.max_new_tokens = max_new_tokens - self.evaluation = None - - scenario = f'Decide if the following statements include {self.attribute}, ' - if scale: - self.evaluation = 'scale' - scenario += f"rank them on a scale from {scale[0]} to {scale[1]}" - elif classes: - self.evaluation = 'classes' - scenario += f"categorize them into the classes {classes}" - scenario += ', please constrain the output only to the result token:\n' - - self.client.setConfig( - scenario=scenario, - max_new_tokens=self.max_new_tokens, - temperature=1.1 - ) - - def classify (self, input: str, trys: int=10) -> any: - - ''' - Trys to classify a provided input. - - [Parameters] - input User input. - trys Will try this many times to generate a classification - within the provided domain. - - [Return] - Returns the classification result in the allowed type. - - ''' - - for _ in range(trys): - sample = self.client.contextInference(input) - if self.evaluation == 'scale': - try: - float(sample) - except: - continue - elif self.evaluation == 'classes' and sample.lower() not in self.classes: - continue - return sample - class console: '''