mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-03 21:29:08 +00:00
Load model from HuggingFace if model_directory unset in config YAML
- Do not save/load the model to/from disk when model_directory unset in config.yml - Add symmetric search default config to cli.py
This commit is contained in:
@@ -39,14 +39,15 @@ def merge_dicts(priority_dict, default_dict):
|
||||
def load_model(model_name, model_dir, model_type):
|
||||
"Load model from disk or huggingface"
|
||||
# Construct model path
|
||||
model_path = join(model_dir, model_name.replace("/", "_"))
|
||||
model_path = join(model_dir, model_name.replace("/", "_")) if model_dir is not None else None
|
||||
|
||||
# Load model from model_path if it exists there
|
||||
if resolve_absolute_path(model_path).exists():
|
||||
if model_path is not None and resolve_absolute_path(model_path).exists():
|
||||
model = model_type(get_absolute_path(model_path))
|
||||
# Else load the model from the model_name
|
||||
else:
|
||||
model = model_type(model_name)
|
||||
model.save(model_path)
|
||||
if model_path is not None:
|
||||
model.save(model_path)
|
||||
|
||||
return model
|
||||
Reference in New Issue
Block a user