Skip to content

Commit

Permalink
fix style
Browse files Browse the repository at this point in the history
  • Loading branch information
echarlaix committed Jan 14, 2025
1 parent c89d2e1 commit d7724ca
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def from_model_id(
f"Backend: {backend} {IMPORT_ERROR.format({backend})}"
)

from optimum.intel import OVModelForCausalLM, OVModelForSeq2SeqLM
from optimum.intel import OVModelForCausalLM, OVModelForSeq2SeqLM # type: ignore[import]

Check failure on line 166 in libs/partners/huggingface/langchain_huggingface/llms/huggingface_pipeline.py

View workflow job for this annotation

GitHub Actions / cd libs/partners/huggingface / make lint #3.12

Ruff (I001)

langchain_huggingface/llms/huggingface_pipeline.py:165:1: I001 Import block is un-sorted or un-formatted

Check failure on line 166 in libs/partners/huggingface/langchain_huggingface/llms/huggingface_pipeline.py

View workflow job for this annotation

GitHub Actions / cd libs/partners/huggingface / make lint #3.9

Ruff (I001)

langchain_huggingface/llms/huggingface_pipeline.py:165:1: I001 Import block is un-sorted or un-formatted
model_cls = (
OVModelForCausalLM
Expand All @@ -175,7 +175,7 @@ def from_model_id(
f"Backend: {backend} {IMPORT_ERROR.format({backend})}"
)

from optimum.intel import IPEXModelForCausalLM, IPEXModelForSeq2SeqLM
from optimum.intel import IPEXModelForCausalLM, IPEXModelForSeq2SeqLM # type: ignore[import]

Check failure on line 179 in libs/partners/huggingface/langchain_huggingface/llms/huggingface_pipeline.py

View workflow job for this annotation

GitHub Actions / cd libs/partners/huggingface / make lint #3.12

Ruff (I001)

langchain_huggingface/llms/huggingface_pipeline.py:178:1: I001 Import block is un-sorted or un-formatted

Check failure on line 179 in libs/partners/huggingface/langchain_huggingface/llms/huggingface_pipeline.py

View workflow job for this annotation

GitHub Actions / cd libs/partners/huggingface / make lint #3.9

Ruff (I001)

langchain_huggingface/llms/huggingface_pipeline.py:178:1: I001 Import block is un-sorted or un-formatted
model_cls = (
IPEXModelForCausalLM
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def compare_versions(
library_or_version: Union[str, version.Version],
operation: str,
requirement_version: str,
):
) -> bool:
"""
Compare a library version to some requirement using a given operation.
Expand All @@ -62,31 +62,32 @@ def compare_versions(
f"`operation` must be one of {list(STR_OPERATION_TO_FUNC.keys())}"
f", received {operation}"
)
operation = STR_OPERATION_TO_FUNC[operation]
if isinstance(library_or_version, str):
library_or_version = version.parse(
importlib.metadata.version(library_or_version)
)
return operation(library_or_version, version.parse(requirement_version))
return STR_OPERATION_TO_FUNC[operation](
library_or_version, version.parse(requirement_version)
)


def is_optimum_available():
def is_optimum_available() -> bool:
return _optimum_available


def is_optimum_intel_available():
def is_optimum_intel_available() -> bool:
return _optimum_intel_available


def is_ipex_available():
def is_ipex_available() -> bool:
return _ipex_available


def is_openvino_available():
def is_openvino_available() -> bool:
return _openvino_available


def is_optimum_version(operation: str, reference_version: str):
def is_optimum_version(operation: str, reference_version: str) -> bool:
"""
Compare the current Optimum version to a given reference with an operation.
"""
Expand All @@ -97,7 +98,7 @@ def is_optimum_version(operation: str, reference_version: str):
)


def is_optimum_intel_version(operation: str, reference_version: str):
def is_optimum_intel_version(operation: str, reference_version: str) -> bool:
"""
Compare the current Optimum Intel version to a given reference with an operation.
"""
Expand Down

0 comments on commit d7724ca

Please sign in to comment.