Skip to content

Commit

Permalink
feat: add hg model id field at model_instance page (#300)
Browse files Browse the repository at this point in the history
This commit add HuggingFace model ID field at model_instance page to help user better navigate the model details (close #299)
  • Loading branch information
EiffelFly authored Nov 24, 2022
1 parent 689f50d commit 31a6eab
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
6 changes: 3 additions & 3 deletions integration-test/common/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export type ExpectCorrectModelDetailsProps = {
| "STATE_UNSPECIFIED"
| "STATE_ERROR";
modelTask: string;
additionalRule?: () => Promise<void>;
additionalRules?: () => Promise<void>;
};

export const expectCorrectModelDetails = async ({
Expand All @@ -127,7 +127,7 @@ export const expectCorrectModelDetails = async ({
modelInstanceTag,
modelState,
modelTask,
additionalRule,
additionalRules,
}: ExpectCorrectModelDetailsProps) => {
await page.goto(`/models/${modelId}`, { waitUntil: "networkidle" });

Expand Down Expand Up @@ -166,7 +166,7 @@ export const expectCorrectModelDetails = async ({
expect(await stateToggle.isChecked()).not.toBeTruthy();
}

if (additionalRule) await additionalRule();
if (additionalRules) await additionalRules();
};

export const expectToDeployModel = async (
Expand Down
7 changes: 7 additions & 0 deletions integration-test/model-huggingface.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,13 @@ test.describe.serial("Hugging face model", () => {
modelInstanceTag,
modelState: "STATE_ONLINE",
modelTask: "CLASSIFICATION",
additionalRules: async () => {
const huggingFaceModelIdField = page.locator(
"input#huggingface-model-id"
);
expect(await huggingFaceModelIdField.isEditable()).toBeFalsy();
await expect(huggingFaceModelIdField).toHaveValue(huggingFaceId);
},
});
});

Expand Down
14 changes: 14 additions & 0 deletions src/components/model/ConfigureModelInstanceForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ const ConfigureModelInstanceForm = ({
status: null,
});

console.log(modelInstance);

return (
<FormBase
padding={null}
Expand Down Expand Up @@ -69,6 +71,18 @@ const ConfigureModelInstanceForm = ({
/>
</>
) : null}
{modelInstance.model_definition === "model-definitions/huggingface" ? (
<>
<BasicTextField
id="huggingface-model-id"
label="HuggingFace model ID"
description="The name of a public HuggingFace model ID, e.g. `google/vit-base-patch16-224`."
value={modelInstance.configuration.repo_id}
disabled={true}
required={true}
/>
</>
) : null}
</div>
<div className="flex flex-row">
<BasicProgressMessageBox
Expand Down

0 comments on commit 31a6eab

Please sign in to comment.