mirror of
https://github.com/lancedb/lancedb.git
synced 2026-05-14 18:40:39 +00:00
add deprecation warnings
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
# SPDX-FileCopyrightText: Copyright The LanceDB Authors
|
||||
|
||||
|
||||
import warnings
|
||||
from typing import List, Union
|
||||
|
||||
import numpy as np
|
||||
@@ -15,6 +16,8 @@ from .utils import weak_lru
|
||||
@register("gte-text")
|
||||
class GteEmbeddings(TextEmbeddingFunction):
|
||||
"""
|
||||
Deprecated: GTE embeddings should be used through sentence-transformers.
|
||||
|
||||
An embedding function that uses GTE-LARGE MLX format(for Apple silicon devices only)
|
||||
as well as the standard cpu/gpu version from: https://huggingface.co/thenlper/gte-large.
|
||||
|
||||
@@ -61,6 +64,13 @@ class GteEmbeddings(TextEmbeddingFunction):
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super().__init__(**kwargs)
|
||||
warnings.warn(
|
||||
"GTE embeddings as a standalone embedding function are deprecated. "
|
||||
"Use the 'sentence-transformers' embedding function with a GTE model "
|
||||
"instead.",
|
||||
DeprecationWarning,
|
||||
stacklevel=3,
|
||||
)
|
||||
self._ndims = None
|
||||
if kwargs:
|
||||
self.mlx = kwargs.get("mlx", False)
|
||||
|
||||
@@ -6,6 +6,7 @@ import io
|
||||
import os
|
||||
from typing import TYPE_CHECKING, List, Union
|
||||
import urllib.parse as urlparse
|
||||
import warnings
|
||||
|
||||
import numpy as np
|
||||
import pyarrow as pa
|
||||
@@ -24,6 +25,7 @@ if TYPE_CHECKING:
|
||||
|
||||
@register("siglip")
|
||||
class SigLipEmbeddings(EmbeddingFunction):
|
||||
# Deprecated: prefer CLIP embeddings via `open-clip`.
|
||||
model_name: str = "google/siglip-base-patch16-224"
|
||||
device: str = "cpu"
|
||||
batch_size: int = 64
|
||||
@@ -36,6 +38,12 @@ class SigLipEmbeddings(EmbeddingFunction):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
warnings.warn(
|
||||
"SigLip embeddings are deprecated. Use CLIP embeddings via the "
|
||||
"'open-clip' embedding function instead.",
|
||||
DeprecationWarning,
|
||||
stacklevel=3,
|
||||
)
|
||||
transformers = attempt_import_or_raise("transformers")
|
||||
self._torch = attempt_import_or_raise("torch")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user