mirror of
https://github.com/lancedb/lancedb.git
synced 2026-08-18 12:08:35 +00:00
fix: preserve seeded IVF-PQ training contracts
This commit is contained in:
@@ -2762,6 +2762,11 @@ class LanceTable(Table):
|
||||
if config is not None and hasattr(config, "accelerator"):
|
||||
acc = getattr(config, "accelerator", None)
|
||||
if acc is not None:
|
||||
if isinstance(config, IvfPq) and config.seed is not None:
|
||||
raise ValueError(
|
||||
"IvfPq seed is not supported with accelerator-based "
|
||||
"index training"
|
||||
)
|
||||
# Dispatch to pylance for GPU acceleration
|
||||
index_type_map = {
|
||||
"IvfFlat": "IVF_FLAT",
|
||||
|
||||
@@ -26,7 +26,7 @@ from lancedb.index import (
|
||||
HnswFlat,
|
||||
FTS,
|
||||
)
|
||||
from lancedb.table import IndexStatistics
|
||||
from lancedb.table import IndexStatistics, LanceTable
|
||||
|
||||
|
||||
@pytest_asyncio.fixture
|
||||
@@ -399,6 +399,11 @@ def test_seeded_ivfpq_rejects_accelerator():
|
||||
with pytest.raises(ValueError, match="seed is not supported with accelerator"):
|
||||
IvfPq(seed=42, accelerator="cuda")
|
||||
|
||||
config = IvfPq(seed=42)
|
||||
config.accelerator = "cuda"
|
||||
with pytest.raises(ValueError, match="seed is not supported with accelerator"):
|
||||
object.__new__(LanceTable).create_index("vector", config=config)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_create_ivfrq_index(some_table: AsyncTable):
|
||||
|
||||
Reference in New Issue
Block a user