From 02b6b221b6f4a906cd41f34e767182ccffd84e82 Mon Sep 17 00:00:00 2001 From: zh-plus Date: Fri, 29 Mar 2024 15:53:19 +0800 Subject: [PATCH] Fix CI issues. --- openlrc/utils.py | 2 -- tests/test_chatbot.py | 10 +++++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/openlrc/utils.py b/openlrc/utils.py index 68e3b5f..89556de 100644 --- a/openlrc/utils.py +++ b/openlrc/utils.py @@ -1,7 +1,6 @@ # Copyright (C) 2024. Hao Zheng # All rights reserved. -import gc import re import subprocess import time @@ -74,7 +73,6 @@ def get_audio_duration(path: Union[str, Path]) -> float: def release_memory(model: torch.nn.Module) -> None: - gc.collect() torch.cuda.empty_cache() del model diff --git a/tests/test_chatbot.py b/tests/test_chatbot.py index 52075a2..283ddf8 100644 --- a/tests/test_chatbot.py +++ b/tests/test_chatbot.py @@ -10,19 +10,23 @@ from openlrc.chatbot import GPTBot, ClaudeBot -class OpenAIUsage(BaseModel): +class Usage(BaseModel): + pass + + +class OpenAIUsage(Usage): prompt_tokens: int completion_tokens: int total_tokens: int -class AnthropicUsage(BaseModel): +class AnthropicUsage(Usage): input_tokens: int output_tokens: int class OpenAIResponse(BaseModel): - usage: Union[OpenAIUsage | AnthropicUsage] + usage: Union[Usage] class TestGPTBot(unittest.TestCase):