Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.

Commit 0892f58

Browse files
committed
fix: hide gpu check windows
1 parent 18c99db commit 0892f58

File tree

3 files changed

+3
-58
lines changed

3 files changed

+3
-58
lines changed

cortex-js/src/usecases/models/models.usecases.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,9 @@ import { TelemetrySource } from '@/domain/telemetry/telemetry.interface';
1717
import { ModelRepository } from '@/domain/repositories/model.interface';
1818
import { ModelParameterParser } from '@/utils/model-parameter.parser';
1919
import {
20-
HuggingFaceRepoData,
2120
HuggingFaceRepoSibling,
2221
} from '@/domain/models/huggingface.interface';
2322
import {
24-
fetchHuggingFaceRepoData,
2523
fetchJanRepoData,
2624
getHFModelMetadata,
2725
} from '@/utils/huggingface';
@@ -530,16 +528,6 @@ export class ModelsUsecases {
530528
else throw 'Model already exists.';
531529
}
532530

533-
/**
534-
* Fetches the model data from HuggingFace
535-
* @param modelId Model repo id. e.g. llama3, llama3:8b, janhq/llama3
536-
* @returns Model metadata
537-
*/
538-
fetchModelMetadata(modelId: string): Promise<HuggingFaceRepoData> {
539-
if (modelId.includes('/')) return fetchHuggingFaceRepoData(modelId);
540-
else return fetchJanRepoData(modelId);
541-
}
542-
543531
/**
544532
* Get the current status of the models
545533
* @returns Model statuses

cortex-js/src/utils/cuda.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ export const getGpuInfo = async (): Promise<GpuSettingInfo[]> =>
109109
new Promise((resolve) => {
110110
exec(
111111
'nvidia-smi --query-gpu=index,memory.total,name --format=csv,noheader,nounits',
112+
{
113+
windowsHide: true,
114+
},
112115
async (error, stdout) => {
113116
if (!error) {
114117
// Get GPU info and gpu has higher memory first

cortex-js/src/utils/huggingface.ts

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -60,52 +60,6 @@ export function guessPromptTemplateFromHuggingFace(jinjaCode?: string): string {
6060
}
6161
}
6262

63-
/**
64-
* Fetches the model data from HuggingFace API
65-
* @param repoId HuggingFace model id. e.g. "janhq/llama-3"
66-
* @returns
67-
*/
68-
export async function fetchHuggingFaceRepoData(
69-
repoId: string,
70-
): Promise<HuggingFaceRepoData> {
71-
const sanitizedUrl = getRepoModelsUrl(repoId);
72-
73-
const { data: response } = await axios.get(sanitizedUrl);
74-
if (response['error'] != null) {
75-
throw new Error(response['error']);
76-
}
77-
78-
const data = response as HuggingFaceRepoData;
79-
80-
if (data.tags.indexOf('gguf') === -1) {
81-
throw `${repoId} is not supported. Only GGUF models are supported.`;
82-
}
83-
84-
// fetching file sizes
85-
const url = new URL(sanitizedUrl);
86-
const paths = url.pathname.split('/').filter((e) => e.trim().length > 0);
87-
88-
for (let i = 0; i < data.siblings.length; i++) {
89-
const downloadUrl = HUGGING_FACE_DOWNLOAD_FILE_MAIN_URL(
90-
[paths[2], paths[3]].join('/'),
91-
data.siblings[i].rfilename,
92-
);
93-
data.siblings[i].downloadUrl = downloadUrl;
94-
}
95-
96-
//TODO: Very hacky? Let's say they don't name it properly
97-
AllQuantizations.forEach((quantization) => {
98-
data.siblings.forEach((sibling: any) => {
99-
if (!sibling.quantization && sibling.rfilename.includes(quantization)) {
100-
sibling.quantization = quantization;
101-
}
102-
});
103-
});
104-
105-
data.modelUrl = HUGGING_FACE_REPO_URL(paths[2], paths[3]);
106-
return data;
107-
}
108-
10963
/**
11064
* Fetch the model data from Jan's repo
11165
* @param modelId HuggingFace model id. e.g. "llama-3:7b"

0 commit comments

Comments
 (0)