Skip to content

Commit

Permalink
Merge pull request #10 from shane-huang/ipex-llm-fix
Browse files Browse the repository at this point in the history
fix lint 2
  • Loading branch information
shane-huang authored Mar 26, 2024
2 parents e5660e8 + 436812c commit 6047f2b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
4 changes: 4 additions & 0 deletions libs/community/langchain_community/llms/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down
12 changes: 7 additions & 5 deletions libs/community/langchain_community/llms/bigdl_llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

logger = logging.getLogger(__name__)


class BigdlLLM(IpexLLM):
"""Wrapper around the BigdlLLM model
Expand All @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -137,7 +139,7 @@ def from_model_id_low_bit(
model_kwargs=_model_kwargs,
**kwargs,
)

@property
def _llm_type(self) -> str:
return "bigdl-llm"
return "bigdl-llm"

0 comments on commit 6047f2b

Please sign in to comment.