Skip to content

[CHORE] Remove validation on ef config update for model path #4571

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def __init__(
self.device = device
self.instruction = instruction

self._model = INSTRUCTOR(model_name, device=device)
self._model = INSTRUCTOR(model_name_or_path=model_name, device=device)

def __call__(self, input: Documents) -> Embeddings:
"""
Expand Down Expand Up @@ -99,10 +99,10 @@ def get_config(self) -> Dict[str, Any]:
def validate_config_update(
self, old_config: Dict[str, Any], new_config: Dict[str, Any]
) -> None:
if "model_name" in new_config:
raise ValueError(
"The model name cannot be changed after the embedding function has been initialized."
)
# model_name is also used as the identifier for model path if stored locally.
# Users should be able to change the path if needed, so we should not validate that.
# e.g. moving file path from /v1/my-model.bin to /v2/my-model.bin
return

@staticmethod
def validate_config(config: Dict[str, Any]) -> None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def __init__(

if model_name not in self.models:
self.models[model_name] = SentenceTransformer(
model_name, device=device, **kwargs
model_name_or_path=model_name, device=device, **kwargs
)
self._model = self.models[model_name]

Expand Down Expand Up @@ -102,10 +102,10 @@ def get_config(self) -> Dict[str, Any]:
def validate_config_update(
self, old_config: Dict[str, Any], new_config: Dict[str, Any]
) -> None:
if "model_name" in new_config:
raise ValueError(
"The model name cannot be changed after the embedding function has been initialized."
)
# model_name is also used as the identifier for model path if stored locally.
# Users should be able to change the path if needed, so we should not validate that.
# e.g. moving file path from /v1/my-model.bin to /v2/my-model.bin
return

@staticmethod
def validate_config(config: Dict[str, Any]) -> None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ def get_config(self) -> Dict[str, Any]:
def validate_config_update(
self, old_config: Dict[str, Any], new_config: Dict[str, Any]
) -> None:
if "model_name" in new_config:
raise ValueError(
"The model name cannot be changed after the embedding function has been initialized."
)
# model_name is also used as the identifier for model path if stored locally.
# Users should be able to change the path if needed, so we should not validate that.
# e.g. moving file path from /v1/my-model.bin to /v2/my-model.bin
return

@staticmethod
def validate_config(config: Dict[str, Any]) -> None:
Expand Down
Loading