mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-10-12 02:12:31 +00:00
docs(rag): add XPU to OpenCLIP provider device options (#7923)
This commit is contained in:
@@ -530,7 +530,7 @@ rag_tool = RagTool(config=config, summarize=True)
|
||||
**خيارات الإعداد:**
|
||||
- `model_name` (str): بنية نموذج OpenCLIP. القيمة الافتراضية: `ViT-B-32`. الخيارات: `ViT-B-32`، `ViT-B-16`، `ViT-L-14`
|
||||
- `checkpoint` (str): اسم نقطة التحقق المُدرّبة مسبقاً. القيمة الافتراضية: `laion2b_s34b_b79k`. الخيارات: `laion2b_s34b_b79k`، `laion400m_e32`، `openai`
|
||||
- `device` (str): الجهاز للتشغيل. القيمة الافتراضية: `cpu`. الخيارات: `cpu`، `cuda`
|
||||
- `device` (str): الجهاز للتشغيل. القيمة الافتراضية: `cpu`. الخيارات: `cpu`، `cuda`، `mps`، `xpu`
|
||||
|
||||
**متغيرات البيئة:**
|
||||
- `EMBEDDINGS_OPENCLIP_MODEL_NAME`: `model_name`
|
||||
|
||||
@@ -530,7 +530,7 @@ The `embedding_model` parameter accepts a `crewai.rag.embeddings.types.ProviderS
|
||||
**Config Options:**
|
||||
- `model_name` (str): OpenCLIP model architecture. Default: `ViT-B-32`. Options: `ViT-B-32`, `ViT-B-16`, `ViT-L-14`
|
||||
- `checkpoint` (str): Pretrained checkpoint name. Default: `laion2b_s34b_b79k`. Options: `laion2b_s34b_b79k`, `laion400m_e32`, `openai`
|
||||
- `device` (str): Device to run on. Default: `cpu`. Options: `cpu`, `cuda`
|
||||
- `device` (str): Device to run on. Default: `cpu`. Options: `cpu`, `cuda`, `mps`, `xpu`
|
||||
|
||||
**Environment Variables:**
|
||||
- `EMBEDDINGS_OPENCLIP_MODEL_NAME`: `model_name`
|
||||
|
||||
@@ -530,7 +530,7 @@ rag_tool = RagTool(config=config, summarize=True)
|
||||
**구성 옵션:**
|
||||
- `model_name` (str): OpenCLIP 모델 아키텍처. 기본값: `ViT-B-32`. 옵션: `ViT-B-32`, `ViT-B-16`, `ViT-L-14`
|
||||
- `checkpoint` (str): 사전 학습된 체크포인트 이름. 기본값: `laion2b_s34b_b79k`. 옵션: `laion2b_s34b_b79k`, `laion400m_e32`, `openai`
|
||||
- `device` (str): 실행할 장치. 기본값: `cpu`. 옵션: `cpu`, `cuda`
|
||||
- `device` (str): 실행할 장치. 기본값: `cpu`. 옵션: `cpu`, `cuda`, `mps`, `xpu`
|
||||
|
||||
**환경 변수:**
|
||||
- `EMBEDDINGS_OPENCLIP_MODEL_NAME`: `model_name`
|
||||
|
||||
@@ -530,7 +530,7 @@ O parâmetro `embedding_model` aceita um dicionário `crewai.rag.embeddings.type
|
||||
**Opções de Configuração:**
|
||||
- `model_name` (str): Arquitetura do modelo OpenCLIP. Padrão: `ViT-B-32`. Opções: `ViT-B-32`, `ViT-B-16`, `ViT-L-14`
|
||||
- `checkpoint` (str): Nome do checkpoint pré-treinado. Padrão: `laion2b_s34b_b79k`. Opções: `laion2b_s34b_b79k`, `laion400m_e32`, `openai`
|
||||
- `device` (str): Dispositivo no qual executar. Padrão: `cpu`. Opções: `cpu`, `cuda`
|
||||
- `device` (str): Dispositivo no qual executar. Padrão: `cpu`. Opções: `cpu`, `cuda`, `mps`, `xpu`
|
||||
|
||||
**Variáveis de Ambiente:**
|
||||
- `EMBEDDINGS_OPENCLIP_MODEL_NAME`: `model_name`
|
||||
|
||||
@@ -33,6 +33,6 @@ class OpenCLIPProvider(BaseEmbeddingsProvider[OpenCLIPEmbeddingFunction]):
|
||||
)
|
||||
device: str | None = Field(
|
||||
default="cpu",
|
||||
description="Device to run model on",
|
||||
description="Device to run model on (e.g., cpu, cuda, mps, xpu)",
|
||||
validation_alias=AliasChoices("EMBEDDINGS_OPENCLIP_DEVICE", "OPENCLIP_DEVICE"),
|
||||
)
|
||||
|
||||
@@ -359,6 +359,18 @@ class TestDocumentationCodeSnippets:
|
||||
)
|
||||
assert provider.model_name == "jina-embeddings-v3"
|
||||
|
||||
@pytest.mark.parametrize("device", ["cpu", "cuda", "mps", "xpu"])
|
||||
def test_ragtool_openclip_config(self, device: str):
|
||||
"""Test documented OpenCLIP device strings are preserved."""
|
||||
provider = OpenCLIPProvider(
|
||||
model_name="ViT-B-32",
|
||||
checkpoint="laion2b_s34b_b79k",
|
||||
device=device,
|
||||
)
|
||||
assert provider.model_name == "ViT-B-32"
|
||||
assert provider.checkpoint == "laion2b_s34b_b79k"
|
||||
assert provider.device == device
|
||||
|
||||
@pytest.mark.parametrize("device", ["cpu", "cuda", "mps", "xpu"])
|
||||
def test_ragtool_sentence_transformer_config(self, device: str):
|
||||
"""Test RagTool SentenceTransformer config from ragtool.mdx.
|
||||
|
||||
Reference in New Issue
Block a user