mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-10 05:39:11 +00:00
Handle image search setup related warning
Ideally should rename model_directory to config_directory or some such but the current image search code will need to be migrated soon. So changing the variable name and creating a migration script for old khoj.yml files using model-directory variable isn't worth it Remove the explicity set of number of threads to use by pytorch. Use the default used by it.
This commit is contained in:
@@ -12,7 +12,6 @@ from sentence_transformers import SentenceTransformer, util
|
|||||||
from PIL import Image
|
from PIL import Image
|
||||||
from tqdm import trange
|
from tqdm import trange
|
||||||
import torch
|
import torch
|
||||||
from khoj.utils import state
|
|
||||||
|
|
||||||
# Internal Packages
|
# Internal Packages
|
||||||
from khoj.utils.helpers import get_absolute_path, get_from_dict, resolve_absolute_path, load_model, timer
|
from khoj.utils.helpers import get_absolute_path, get_from_dict, resolve_absolute_path, load_model, timer
|
||||||
@@ -26,9 +25,6 @@ logger = logging.getLogger(__name__)
|
|||||||
|
|
||||||
|
|
||||||
def initialize_model(search_config: ImageSearchConfig):
|
def initialize_model(search_config: ImageSearchConfig):
|
||||||
# Initialize Model
|
|
||||||
torch.set_num_threads(4)
|
|
||||||
|
|
||||||
# Convert model directory to absolute path
|
# Convert model directory to absolute path
|
||||||
search_config.model_directory = resolve_absolute_path(search_config.model_directory)
|
search_config.model_directory = resolve_absolute_path(search_config.model_directory)
|
||||||
|
|
||||||
|
|||||||
@@ -72,6 +72,9 @@ class ImageSearchConfig(ConfigBase):
|
|||||||
encoder_type: Optional[str] = None
|
encoder_type: Optional[str] = None
|
||||||
model_directory: Optional[Path] = None
|
model_directory: Optional[Path] = None
|
||||||
|
|
||||||
|
class Config:
|
||||||
|
protected_namespaces = ()
|
||||||
|
|
||||||
|
|
||||||
class SearchConfig(ConfigBase):
|
class SearchConfig(ConfigBase):
|
||||||
image: Optional[ImageSearchConfig] = None
|
image: Optional[ImageSearchConfig] = None
|
||||||
|
|||||||
Reference in New Issue
Block a user