feat: add precision option (fp32/fp16/bf16) in settings#703
Conversation
* doc: update README.md
* ci: update Release.yml * ci: fix actions/upload-artifact@v4
* feat: option for using tile
* ci: fix codecov * build: bump ccrestoration to 0.2.2
* build: use uv as pkg manager * build: update pre-commit-config * ci: update * build: remove torchaudio * ci: uv sync --no-default-groups --group dev * build: update pyinstaller * build: uv default run will auto sync all pkgs
Add a precision config field (fp32/fp16/bf16, default fp32) and map it to cccv's fp16/bf16 arguments. bf16 avoids the fp16 numerical overflow that yields NaN output on some transformer models, at the same VRAM savings as fp16. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add a precision selector to the settings page (default fp32) that is sent to the core. bf16 keeps fp16's VRAM savings without the overflow that produces black/NaN output on some transformer models. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds a user-selectable compute precision setting (FP32/FP16/BF16) to Final2x and propagates it into the generated core config.
Changes:
- Introduces a new
precisionfield in settings store and core config payload - Adds a precision selector to the Final2x settings UI
- Adds localized UI strings and a shared options list for precision choices
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/shared/type/core.ts | Extends core config type to include precision |
| src/renderer/src/views/Final2xSettings.vue | Adds UI controls for selecting precision |
| src/renderer/src/utils/getFinal2xCoreConfig.ts | Serializes precision into the core config |
| src/renderer/src/utils/SROptions.ts | Defines the selectable precision options |
| src/renderer/src/store/SRSettingsStore.ts | Stores the selected precision with a default |
| src/renderer/src/locales/zh.ts | Adds i18n strings for precision UI/help text |
| src/renderer/src/locales/ja.ts | Adds i18n strings for precision UI/help text |
| src/renderer/src/locales/fr.ts | Adds i18n strings for precision UI/help text |
| src/renderer/src/locales/en.ts | Adds i18n strings for precision UI/help text |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| output_path: string | ||
| input_path: string[] | ||
| use_tile: boolean | ||
| precision: string | ||
| save_format: string |
| const ghProxy: Ref<string | null> = ref(null) | ||
| const targetScale: Ref<number | null> = ref(null) | ||
| const useTile: Ref<boolean> = ref(true) | ||
| const precision: Ref<string> = ref('fp32') |
| export const precisionList: Ref<any[]> = ref([ | ||
| { value: 'fp32', label: 'FP32' }, | ||
| { value: 'fp16', label: 'FP16' }, | ||
| { value: 'bf16', label: 'BF16' }, | ||
| ]) |
There was a problem hiding this comment.
Code Review
This pull request introduces a new 'Precision' setting (supporting FP32, FP16, and BF16) across the application, including UI controls, localized descriptions, state management, and configuration generation. The review feedback focuses on improving type safety by replacing generic types (string and any[]) with literal union types ('fp32' | 'fp16' | 'bf16') for the precision state, configuration interface, and options list.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| const ghProxy: Ref<string | null> = ref(null) | ||
| const targetScale: Ref<number | null> = ref(null) | ||
| const useTile: Ref<boolean> = ref(true) | ||
| const precision: Ref<string> = ref('fp32') |
There was a problem hiding this comment.
Using a generic string type for precision reduces type safety. Since the precision options are fixed (fp32, fp16, bf16), it is highly recommended to use a union of literal types to prevent invalid values and improve IDE autocompletion.
| const precision: Ref<string> = ref('fp32') | |
| const precision: Ref<'fp32' | 'fp16' | 'bf16'> = ref('fp32') |
| output_path: string | ||
| input_path: string[] | ||
| use_tile: boolean | ||
| precision: string |
There was a problem hiding this comment.
Using a generic string type for precision in the core configuration interface reduces type safety. Specifying the exact allowed values ('fp32' | 'fp16' | 'bf16') ensures that only valid precision configurations are sent to the core.
| precision: string | |
| precision: 'fp32' | 'fp16' | 'bf16' |
| { value: '.tiff', label: 'TIFF' }, | ||
| ]) | ||
|
|
||
| export const precisionList: Ref<any[]> = ref([ |
There was a problem hiding this comment.
Avoid using any[] for precisionList. Typing the array elements with the specific shape and literal values improves type safety and prevents potential runtime errors.
| export const precisionList: Ref<any[]> = ref([ | |
| export const precisionList: Ref<{ value: 'fp32' | 'fp16' | 'bf16'; label: string }[]> = ref([ |
Add a precision selector to the settings page (default fp32) that is sent to the core. bf16 keeps fp16's VRAM savings without the overflow that produces black/NaN output on some transformer models.