add hf-mirror for cn users
This commit is contained in:
parent
a9819139b8
commit
8781416cfb
@ -270,5 +270,6 @@
|
|||||||
"Server is working on deployment mode, please exit the program manually to stop the server": "サーバーはデプロイモードで動作しています、サーバーを停止するにはプログラムを手動で終了してください",
|
"Server is working on deployment mode, please exit the program manually to stop the server": "サーバーはデプロイモードで動作しています、サーバーを停止するにはプログラムを手動で終了してください",
|
||||||
"You can increase the number of stored layers in Configs page to improve performance": "パフォーマンスを向上させるために、保存されるレイヤーの数を設定ページで増やすことができます",
|
"You can increase the number of stored layers in Configs page to improve performance": "パフォーマンスを向上させるために、保存されるレイヤーの数を設定ページで増やすことができます",
|
||||||
"Failed to load model, try to increase the virtual memory (Swap of WSL) or use a smaller base model.": "モデルの読み込みに失敗しました、仮想メモリ (WSL Swap) を増やすか小さなベースモデルを使用してみてください。",
|
"Failed to load model, try to increase the virtual memory (Swap of WSL) or use a smaller base model.": "モデルの読み込みに失敗しました、仮想メモリ (WSL Swap) を増やすか小さなベースモデルを使用してみてください。",
|
||||||
"Save Conversation": "会話を保存"
|
"Save Conversation": "会話を保存",
|
||||||
|
"Use Hugging Face Mirror": "Hugging Faceミラーを使用"
|
||||||
}
|
}
|
@ -270,5 +270,6 @@
|
|||||||
"Server is working on deployment mode, please exit the program manually to stop the server": "服务器正在部署模式下运行,请手动退出程序以停止服务器",
|
"Server is working on deployment mode, please exit the program manually to stop the server": "服务器正在部署模式下运行,请手动退出程序以停止服务器",
|
||||||
"You can increase the number of stored layers in Configs page to improve performance": "你可以在配置页面增加载入显存层数以提升性能",
|
"You can increase the number of stored layers in Configs page to improve performance": "你可以在配置页面增加载入显存层数以提升性能",
|
||||||
"Failed to load model, try to increase the virtual memory (Swap of WSL) or use a smaller base model.": "模型载入失败,尝试增加虚拟内存(WSL Swap),或使用一个更小规模的基底模型",
|
"Failed to load model, try to increase the virtual memory (Swap of WSL) or use a smaller base model.": "模型载入失败,尝试增加虚拟内存(WSL Swap),或使用一个更小规模的基底模型",
|
||||||
"Save Conversation": "保存对话"
|
"Save Conversation": "保存对话",
|
||||||
|
"Use Hugging Face Mirror": "使用Hugging Face镜像源"
|
||||||
}
|
}
|
@ -11,7 +11,7 @@ import { Button } from '@fluentui/react-components';
|
|||||||
import { observer } from 'mobx-react-lite';
|
import { observer } from 'mobx-react-lite';
|
||||||
import { exit, getStatus, readRoot, switchModel, updateConfig } from '../apis';
|
import { exit, getStatus, readRoot, switchModel, updateConfig } from '../apis';
|
||||||
import { toast } from 'react-toastify';
|
import { toast } from 'react-toastify';
|
||||||
import { checkDependencies, getStrategy, toastWithButton } from '../utils';
|
import { checkDependencies, getHfDownloadUrl, getStrategy, toastWithButton } from '../utils';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { ToolTipButton } from './ToolTipButton';
|
import { ToolTipButton } from './ToolTipButton';
|
||||||
import { Play16Regular, Stop16Regular } from '@fluentui/react-icons';
|
import { Play16Regular, Stop16Regular } from '@fluentui/react-icons';
|
||||||
@ -94,7 +94,7 @@ export const RunButton: FC<{ onClickRun?: MouseEventHandler, iconMode?: boolean
|
|||||||
navigate({ pathname: '/downloads' });
|
navigate({ pathname: '/downloads' });
|
||||||
},
|
},
|
||||||
{ autoClose: 3000 });
|
{ autoClose: 3000 });
|
||||||
AddToDownloadList(modelPath, downloadUrl);
|
AddToDownloadList(modelPath, getHfDownloadUrl(downloadUrl));
|
||||||
} else {
|
} else {
|
||||||
toast(t('Can not find download url'), { type: 'error' });
|
toast(t('Can not find download url'), { type: 'error' });
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import React, { FC } from 'react';
|
import React, { FC } from 'react';
|
||||||
import {
|
import {
|
||||||
|
Checkbox,
|
||||||
createTableColumn,
|
createTableColumn,
|
||||||
DataGrid,
|
DataGrid,
|
||||||
DataGridBody,
|
DataGridBody,
|
||||||
@ -19,7 +20,7 @@ import commonStore from '../stores/commonStore';
|
|||||||
import { BrowserOpenURL } from '../../wailsjs/runtime';
|
import { BrowserOpenURL } from '../../wailsjs/runtime';
|
||||||
import { AddToDownloadList, OpenFileFolder } from '../../wailsjs/go/backend_golang/App';
|
import { AddToDownloadList, OpenFileFolder } from '../../wailsjs/go/backend_golang/App';
|
||||||
import { Page } from '../components/Page';
|
import { Page } from '../components/Page';
|
||||||
import { bytesToGb, refreshModels, saveConfigs, toastWithButton } from '../utils';
|
import { bytesToGb, getHfDownloadUrl, refreshModels, saveConfigs, toastWithButton } from '../utils';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { useNavigate } from 'react-router';
|
import { useNavigate } from 'react-router';
|
||||||
import { ModelSourceItem } from '../types/models';
|
import { ModelSourceItem } from '../types/models';
|
||||||
@ -139,7 +140,7 @@ const columns: TableColumnDefinition<ModelSourceItem>[] = [
|
|||||||
navigate({ pathname: '/downloads' });
|
navigate({ pathname: '/downloads' });
|
||||||
},
|
},
|
||||||
{ autoClose: 3000 });
|
{ autoClose: 3000 });
|
||||||
AddToDownloadList(`${commonStore.settings.customModelsPath}/${item.name}`, item.downloadUrl!);
|
AddToDownloadList(`${commonStore.settings.customModelsPath}/${item.name}`, getHfDownloadUrl(item.downloadUrl!));
|
||||||
}} />}
|
}} />}
|
||||||
{item.url && <ToolTipButton desc={t('Open Url')} icon={<Open20Regular />} onClick={() => {
|
{item.url && <ToolTipButton desc={t('Open Url')} icon={<Open20Regular />} onClick={() => {
|
||||||
BrowserOpenURL(item.url!);
|
BrowserOpenURL(item.url!);
|
||||||
@ -160,10 +161,21 @@ const Models: FC = observer(() => {
|
|||||||
<div className="flex flex-col gap-1">
|
<div className="flex flex-col gap-1">
|
||||||
<div className="flex justify-between items-center">
|
<div className="flex justify-between items-center">
|
||||||
<Text weight="medium">{t('Model Source Manifest List')}</Text>
|
<Text weight="medium">{t('Model Source Manifest List')}</Text>
|
||||||
<ToolTipButton desc={t('Refresh')} icon={<ArrowClockwise20Regular />} onClick={() => {
|
<div className="flex">
|
||||||
refreshModels(false);
|
{commonStore.settings.language === 'zh' &&
|
||||||
saveConfigs();
|
<Checkbox className="select-none"
|
||||||
}} />
|
size="large" label={t('Use Hugging Face Mirror')}
|
||||||
|
checked={commonStore.settings.useHfMirror}
|
||||||
|
onChange={(_, data) => {
|
||||||
|
commonStore.setSettings({
|
||||||
|
useHfMirror: data.checked as boolean
|
||||||
|
});
|
||||||
|
}} />}
|
||||||
|
<ToolTipButton desc={t('Refresh')} icon={<ArrowClockwise20Regular />} onClick={() => {
|
||||||
|
refreshModels(false);
|
||||||
|
saveConfigs();
|
||||||
|
}} />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<Text size={100}>
|
<Text size={100}>
|
||||||
{t('Provide JSON file URLs for the models manifest. Separate URLs with semicolons. The "models" field in JSON files will be parsed into the following table.')}
|
{t('Provide JSON file URLs for the models manifest. Separate URLs with semicolons. The "models" field in JSON files will be parsed into the following table.')}
|
||||||
|
@ -142,6 +142,7 @@ class CommonStore {
|
|||||||
autoUpdatesCheck: true,
|
autoUpdatesCheck: true,
|
||||||
giteeUpdatesSource: getUserLanguage() === 'zh',
|
giteeUpdatesSource: getUserLanguage() === 'zh',
|
||||||
cnMirror: getUserLanguage() === 'zh',
|
cnMirror: getUserLanguage() === 'zh',
|
||||||
|
useHfMirror: false,
|
||||||
host: '127.0.0.1',
|
host: '127.0.0.1',
|
||||||
dpiScaling: 100,
|
dpiScaling: 100,
|
||||||
customModelsPath: './models',
|
customModelsPath: './models',
|
||||||
|
@ -10,6 +10,7 @@ export type SettingsType = {
|
|||||||
autoUpdatesCheck: boolean
|
autoUpdatesCheck: boolean
|
||||||
giteeUpdatesSource: boolean
|
giteeUpdatesSource: boolean
|
||||||
cnMirror: boolean
|
cnMirror: boolean
|
||||||
|
useHfMirror: boolean
|
||||||
host: string
|
host: string
|
||||||
dpiScaling: number
|
dpiScaling: number
|
||||||
customModelsPath: string
|
customModelsPath: string
|
||||||
|
@ -474,6 +474,12 @@ export function toastWithButton(text: string, buttonText: string, onClickButton:
|
|||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getHfDownloadUrl(url: string) {
|
||||||
|
if (commonStore.settings.useHfMirror && url.includes('huggingface.co') && url.includes('resolve'))
|
||||||
|
return url.replace('huggingface.co', 'hf-mirror.com');
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
export function getSupportedCustomCudaFile(isBeta: boolean) {
|
export function getSupportedCustomCudaFile(isBeta: boolean) {
|
||||||
if ([' 10', ' 16', ' 20', ' 30', 'MX', 'Tesla P', 'Quadro P', 'NVIDIA P', 'TITAN X', 'TITAN RTX', 'RTX A',
|
if ([' 10', ' 16', ' 20', ' 30', 'MX', 'Tesla P', 'Quadro P', 'NVIDIA P', 'TITAN X', 'TITAN RTX', 'RTX A',
|
||||||
'Quadro RTX 4000', 'Quadro RTX 5000', 'Tesla T4', 'NVIDIA A10', 'NVIDIA A40'].some(v => commonStore.status.device_name.includes(v)))
|
'Quadro RTX 4000', 'Quadro RTX 5000', 'Tesla T4', 'NVIDIA A10', 'NVIDIA A40'].some(v => commonStore.status.device_name.includes(v)))
|
||||||
|
Loading…
Reference in New Issue
Block a user