Skip to content

Commit be9cbc3

Browse files
committed
chore(translation): use i18n framework for qwen quantization strings
1 parent 7041b70 commit be9cbc3

2 files changed

Lines changed: 14 additions & 8 deletions

File tree

invokeai/frontend/web/public/locales/en.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1219,6 +1219,9 @@
12191219
"qwenImageComponentSource": "VAE/Encoder Source (Diffusers)",
12201220
"qwenImageComponentSourcePlaceholder": "Required for GGUF models",
12211221
"qwenImageQuantization": "Encoder Quantization",
1222+
"qwenImageQuantizationNone": "None (bf16)",
1223+
"qwenImageQuantizationInt8": "8-bit (int8)",
1224+
"qwenImageQuantizationNf4": "4-bit (nf4)",
12221225
"qwenImageShift": "Shift Override (e.g. 3 for Lightning)",
12231226
"upcastAttention": "Upcast Attention",
12241227
"uploadImage": "Upload Image",

invokeai/frontend/web/src/features/parameters/components/Advanced/ParamQwenImageQuantization.tsx

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,6 @@ import { qwenImageQuantizationChanged, selectQwenImageQuantization } from 'featu
55
import { memo, useCallback, useMemo } from 'react';
66
import { useTranslation } from 'react-i18next';
77

8-
const QUANTIZATION_OPTIONS: ComboboxOption[] = [
9-
{ value: 'none', label: 'None (bf16)' },
10-
{ value: 'int8', label: '8-bit (int8)' },
11-
{ value: 'nf4', label: '4-bit (nf4)' },
12-
];
13-
148
const isValidQuantization = (value: string | undefined): value is 'none' | 'int8' | 'nf4' => {
159
return value === 'none' || value === 'int8' || value === 'nf4';
1610
};
@@ -20,7 +14,16 @@ const ParamQwenImageQuantization = memo(() => {
2014
const { t } = useTranslation();
2115
const quantization = useAppSelector(selectQwenImageQuantization);
2216

23-
const value = useMemo(() => QUANTIZATION_OPTIONS.find((o) => o.value === quantization), [quantization]);
17+
const options = useMemo<ComboboxOption[]>(
18+
() => [
19+
{ value: 'none', label: t('modelManager.qwenImageQuantizationNone') },
20+
{ value: 'int8', label: t('modelManager.qwenImageQuantizationInt8') },
21+
{ value: 'nf4', label: t('modelManager.qwenImageQuantizationNf4') },
22+
],
23+
[t]
24+
);
25+
26+
const value = useMemo(() => options.find((o) => o.value === quantization), [options, quantization]);
2427

2528
const onChange = useCallback<ComboboxOnChange>(
2629
(v) => {
@@ -35,7 +38,7 @@ const ParamQwenImageQuantization = memo(() => {
3538
return (
3639
<FormControl minW={0} flexGrow={1} gap={2}>
3740
<FormLabel m={0}>{t('modelManager.qwenImageQuantization')}</FormLabel>
38-
<Combobox value={value} options={QUANTIZATION_OPTIONS} onChange={onChange} />
41+
<Combobox value={value} options={options} onChange={onChange} />
3942
</FormControl>
4043
);
4144
});

0 commit comments

Comments
 (0)