Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
machineuser
commited on
Commit
·
e7f21e7
1
Parent(s):
62d2745
Sync widgets demo
Browse files
packages/widgets/src/lib/components/InferenceWidget/shared/WidgetInfo/WidgetInfo.svelte
CHANGED
@@ -26,27 +26,12 @@
|
|
26 |
[LoadState.Error]: "⚠️ This model could not be loaded.",
|
27 |
} as const;
|
28 |
|
29 |
-
function getStatusReport(
|
30 |
-
modelLoadInfo: ModelLoadInfo | undefined,
|
31 |
-
statuses: Record<LoadState, string>,
|
32 |
-
isAzure = false
|
33 |
-
): string {
|
34 |
if (!modelLoadInfo) {
|
35 |
return "Model state unknown";
|
36 |
}
|
37 |
-
if (modelLoadInfo.compute_type === ComputeType.CPU && modelLoadInfo.state === LoadState.Loaded && !isAzure) {
|
38 |
-
return `The model is loaded and running on <a class="hover:underline" href="https://huggingface.co/intel" target="_blank">Intel Xeon 3rd Gen Scalable CPU</a>`;
|
39 |
-
}
|
40 |
return statuses[modelLoadInfo.state];
|
41 |
}
|
42 |
-
|
43 |
-
function getComputeTypeMsg(): string {
|
44 |
-
const computeType = modelLoadInfo?.compute_type ?? ComputeType.CPU;
|
45 |
-
if (computeType === ComputeType.CPU) {
|
46 |
-
return "Intel Xeon 3rd Gen Scalable cpu";
|
47 |
-
}
|
48 |
-
return computeType;
|
49 |
-
}
|
50 |
</script>
|
51 |
|
52 |
<div class="mt-2">
|
@@ -63,11 +48,11 @@
|
|
63 |
</div>
|
64 |
<div class="border-dotter mx-2 flex flex-1 -translate-y-px border-b border-gray-100" />
|
65 |
<div>
|
66 |
-
{@html getStatusReport(modelLoadInfo, azureState
|
67 |
</div>
|
68 |
</div>
|
69 |
{:else if computeTime}
|
70 |
-
Computation time on {
|
71 |
{:else if (model.inference === InferenceDisplayability.Yes || model.pipeline_tag === "reinforcement-learning") && !modelTooBig}
|
72 |
{@html getStatusReport(modelLoadInfo, state)}
|
73 |
{:else if model.inference === InferenceDisplayability.ExplicitOptOut}
|
|
|
26 |
[LoadState.Error]: "⚠️ This model could not be loaded.",
|
27 |
} as const;
|
28 |
|
29 |
+
function getStatusReport(modelLoadInfo: ModelLoadInfo | undefined, statuses: Record<LoadState, string>): string {
|
|
|
|
|
|
|
|
|
30 |
if (!modelLoadInfo) {
|
31 |
return "Model state unknown";
|
32 |
}
|
|
|
|
|
|
|
33 |
return statuses[modelLoadInfo.state];
|
34 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
</script>
|
36 |
|
37 |
<div class="mt-2">
|
|
|
48 |
</div>
|
49 |
<div class="border-dotter mx-2 flex flex-1 -translate-y-px border-b border-gray-100" />
|
50 |
<div>
|
51 |
+
{@html getStatusReport(modelLoadInfo, azureState)}
|
52 |
</div>
|
53 |
</div>
|
54 |
{:else if computeTime}
|
55 |
+
Computation time on {modelLoadInfo?.compute_type ?? ComputeType.CPU}: {computeTime}
|
56 |
{:else if (model.inference === InferenceDisplayability.Yes || model.pipeline_tag === "reinforcement-learning") && !modelTooBig}
|
57 |
{@html getStatusReport(modelLoadInfo, state)}
|
58 |
{:else if model.inference === InferenceDisplayability.ExplicitOptOut}
|