From 436812c39dd0198e8a64fab9447d8bd40162861b Mon Sep 17 00:00:00 2001 From: Shengsheng Huang Date: Wed, 27 Mar 2024 02:19:09 +0800 Subject: [PATCH] fix lint --- libs/community/langchain_community/llms/__init__.py | 4 ++++ libs/community/langchain_community/llms/bigdl_llm.py | 12 +++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/libs/community/langchain_community/llms/__init__.py b/libs/community/langchain_community/llms/__init__.py index b87e9239b64e8..36b52158721d6 100644 --- a/libs/community/langchain_community/llms/__init__.py +++ b/libs/community/langchain_community/llms/__init__.py @@ -113,11 +113,13 @@ def _import_bedrock() -> Type[BaseLLM]: return Bedrock + def _import_bigdlllm() -> Type[BaseLLM]: from langchain_community.llms.bigdl_llm import BigdlLLM return BigdlLLM + def _import_bittensor() -> Type[BaseLLM]: from langchain_community.llms.bittensor import NIBittensorLLM @@ -281,11 +283,13 @@ def _import_human() -> Type[BaseLLM]: return HumanInputLLM + def _import_ipex_llm() -> Type[BaseLLM]: from langchain_community.llms.ipex_llm import IpexLLM return IpexLLM + def _import_javelin_ai_gateway() -> Type[BaseLLM]: from langchain_community.llms.javelin_ai_gateway import JavelinAIGateway diff --git a/libs/community/langchain_community/llms/bigdl_llm.py b/libs/community/langchain_community/llms/bigdl_llm.py index 9b9bf9f30107c..f225587a73331 100644 --- a/libs/community/langchain_community/llms/bigdl_llm.py +++ b/libs/community/langchain_community/llms/bigdl_llm.py @@ -7,6 +7,7 @@ logger = logging.getLogger(__name__) + class BigdlLLM(IpexLLM): """Wrapper around the BigdlLLM model @@ -16,6 +17,7 @@ class BigdlLLM(IpexLLM): from langchain_community.llms import BigdlLLM llm = BigdlLLM.from_model_id(model_id="THUDM/chatglm-6b") """ + @classmethod def from_model_id( cls, @@ -36,7 +38,7 @@ def from_model_id( An object of BigdlLLM. """ logger.warning("BigdlLLM was deprecated. Please use IpexLLM instead.") - + try: from bigdl.llm.transformers import ( AutoModel, @@ -98,9 +100,9 @@ def from_model_id_low_bit( Returns: An object of BigdlLLM. """ - + logger.warning("BigdlLLM was deprecated. Please use IpexLLM instead.") - + try: from bigdl.llm.transformers import ( AutoModel, @@ -137,7 +139,7 @@ def from_model_id_low_bit( model_kwargs=_model_kwargs, **kwargs, ) - + @property def _llm_type(self) -> str: - return "bigdl-llm" \ No newline at end of file + return "bigdl-llm"