mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-16 15:04:13 +00:00
community: add Intel GPU support to ipex-llm
llm integration (#22458)
**Description:** [IPEX-LLM](https://github.com/intel-analytics/ipex-llm) is a PyTorch library for running LLM on Intel CPU and GPU (e.g., local PC with iGPU, discrete GPU such as Arc, Flex and Max) with very low latency. This PR adds Intel GPU support to `ipex-llm` llm integration. **Dependencies:** `ipex-llm` **Contribution maintainer**: @ivy-lv11 @Oscilloscope98 **tests and docs**: - Add: langchain/docs/docs/integrations/llms/ipex_llm_gpu.ipynb - Update: langchain/docs/docs/integrations/llms/ipex_llm_gpu.ipynb - Update: langchain/libs/community/tests/llms/test_ipex_llm.py --------- Co-authored-by: ivy-lv11 <zhicunlv@gmail.com>
This commit is contained in:
@@ -13,12 +13,18 @@ skip_if_no_model_ids = pytest.mark.skipif(
|
||||
not model_ids_to_test, reason="TEST_IPEXLLM_MODEL_IDS environment variable not set."
|
||||
)
|
||||
model_ids_to_test = [model_id.strip() for model_id in model_ids_to_test.split(",")] # type: ignore
|
||||
device = os.getenv("TEST_IPEXLLM_MODEL_DEVICE") or "cpu"
|
||||
|
||||
|
||||
def load_model(model_id: str) -> Any:
|
||||
llm = IpexLLM.from_model_id(
|
||||
model_id=model_id,
|
||||
model_kwargs={"temperature": 0, "max_length": 16, "trust_remote_code": True},
|
||||
model_kwargs={
|
||||
"temperature": 0,
|
||||
"max_length": 16,
|
||||
"trust_remote_code": True,
|
||||
"device": device,
|
||||
},
|
||||
)
|
||||
return llm
|
||||
|
||||
|
Reference in New Issue
Block a user