Skip to content

Commit

Permalink
[FIX] Install correct clip dep for llama-index-embeddings-clip (#10759)
Browse files Browse the repository at this point in the history
* remove wrong clip; add correct one

* CHANGELOG

* remove clip as can't publish pypi packwage with git dep

* remove clip as can't publish pypi packwage with git dep
  • Loading branch information
nerdai authored Feb 15, 2024
1 parent be26e8e commit 036ff28
Show file tree
Hide file tree
Showing 4 changed files with 1,014 additions and 949 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# CHANGELOG

## [0.1.2] - 2024-2-15

- Remove incorrect one; resort back to lazy load of clip/torch
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
import logging
from typing import Any, List

import torch
from llama_index.core.base.embeddings.base import Embedding
from llama_index.core.bridge.pydantic import Field, PrivateAttr
from llama_index.core.constants import DEFAULT_EMBED_BATCH_SIZE
from llama_index.core.embeddings.multi_modal_base import MultiModalEmbedding
from llama_index.core.schema import ImageType
from PIL import Image

import clip

logger = logging.getLogger(__name__)


Expand Down Expand Up @@ -75,6 +72,14 @@ def __init__(
if embed_batch_size <= 0:
raise ValueError(f"Embed batch size {embed_batch_size} must be > 0.")

try:
import clip
import torch
except ImportError:
raise ImportError(
"ClipEmbedding requires `pip install git+https://github.com/openai/CLIP.git` and torch."
)

super().__init__(
embed_batch_size=embed_batch_size, model_name=model_name, **kwargs
)
Expand Down
Loading

0 comments on commit 036ff28

Please sign in to comment.