Skip to content

Commit

Permalink
Fix embed dim value
Browse files Browse the repository at this point in the history
  • Loading branch information
moria97 committed Jun 4, 2024
1 parent 860ea11 commit f955786
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
6 changes: 5 additions & 1 deletion src/pai_rag/app/web/tabs/settings_tab.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ def change_emb_source(source):
embed_model: gr.update(visible=(source == "HuggingFace")),
embed_dim: EMBEDDING_DIM_DICT.get(
view_model.embed_model, DEFAULT_EMBED_SIZE
),
)
if source == "HuggingFace"
else DEFAULT_EMBED_SIZE,
}

def change_emb_model(model):
Expand All @@ -69,6 +71,8 @@ def change_emb_model(model):
embed_dim: EMBEDDING_DIM_DICT.get(
view_model.embed_model, DEFAULT_EMBED_SIZE
)
if view_model.embed_source == "HuggingFace"
else DEFAULT_EMBED_SIZE,
}

embed_source.change(
Expand Down
9 changes: 6 additions & 3 deletions src/pai_rag/app/web/view_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,9 +313,12 @@ def to_component_settings(self) -> Dict[str, Dict[str, Any]]:
"value": self.embed_model,
"visible": self.embed_source == "HuggingFace",
}
settings["embed_dim"] = {
"value": EMBEDDING_DIM_DICT.get(self.embed_model, DEFAULT_EMBED_SIZE)
}
settings["embed_dim"] = (
{"value": EMBEDDING_DIM_DICT.get(self.embed_model, DEFAULT_EMBED_SIZE)}
if self.embed_source == "HuggingFace"
else DEFAULT_EMBED_SIZE
)

settings["llm"] = {"value": self.llm}
settings["llm_eas_url"] = {"value": self.llm_eas_url}
settings["llm_eas_token"] = {"value": self.llm_eas_token}
Expand Down

0 comments on commit f955786

Please sign in to comment.