Skip to content

Commit

Permalink
Fixed qdrant init error
Browse files Browse the repository at this point in the history
  • Loading branch information
khoroshevskyi committed Dec 17, 2024
1 parent 1018496 commit 8134d8f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions bbconf/modules/bedfiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from tqdm import tqdm

from bbconf.config_parser.bedbaseconfig import BedBaseConfig
from geniml.search.backends import QdrantBackend
from bbconf.const import DEFAULT_LICENSE, PKG_NAME, ZARR_TOKENIZED_FOLDER
from bbconf.db_utils import (
Bed,
Expand Down Expand Up @@ -1027,7 +1028,7 @@ def upload_file_qdrant(

_LOGGER.debug(f"Adding bed file to qdrant. bed_id: {bed_id}")

if not self._qdrant_engine:
if not isinstance(self._qdrant_engine, QdrantBackend):
raise QdrantInstanceNotInitializedError("Could not upload file.")

bed_embedding = self._embed_file(bed_file)
Expand Down Expand Up @@ -1056,7 +1057,11 @@ def _embed_file(self, bed_file: Union[str, RegionSet]) -> np.ndarray:
)

if isinstance(bed_file, str):
bed_region_set = GRegionSet(bed_file)
# Use try if file is corrupted. In Python RegionSet we have functionality to tackle this problem
try:
bed_region_set = GRegionSet(bed_file)
except RuntimeError as _:
bed_region_set = RegionSet(bed_file)
elif isinstance(bed_file, RegionSet) or isinstance(bed_file, GRegionSet):
bed_region_set = bed_file
else:
Expand Down

0 comments on commit 8134d8f

Please sign in to comment.