Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions gui/lib/features/params/providers/params_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class ParamsState {
this.height,
this.seed = -1,
this.cacheMode = 'None',
this.previewMode = 'None',
this.previewMode = 'Fast',
this.upscalerMode = 'None',
this.upscalerScale = 2.0,
this.token = '',
Expand All @@ -62,8 +62,9 @@ class ParamsState {
}) {
return ParamsState(
selectedPreset: selectedPreset ?? this.selectedPreset,
selectedWeight:
selectedWeightFn != null ? selectedWeightFn() : selectedWeight,
selectedWeight: selectedWeightFn != null
? selectedWeightFn()
: selectedWeight,
prompt: prompt ?? this.prompt,
negativePrompt: negativePrompt ?? this.negativePrompt,
steps: stepsFn != null ? stepsFn() : steps,
Expand Down
2 changes: 1 addition & 1 deletion gui/lib/features/params/sections/generation_section.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class _GenerationSectionState extends ConsumerState<GenerationSection> {
late final TextEditingController _widthController;
late final TextEditingController _heightController;

static const _previewModes = ['None', 'Fast', 'Accurate'];
static const _previewModes = ['Fast', 'Accurate'];

@override
void initState() {
Expand Down
22 changes: 8 additions & 14 deletions gui/lib/features/params/sections/postproc_section.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class PostprocSection extends ConsumerStatefulWidget {
class _PostprocSectionState extends ConsumerState<PostprocSection> {
late final TextEditingController _scaleController;

static const _previewModes = ['None', 'Fast', 'Accurate'];
static const _previewModes = ['Fast', 'Accurate'];

static const _upscalerModes = [
'None',
Expand Down Expand Up @@ -50,8 +50,7 @@ class _PostprocSectionState extends ConsumerState<PostprocSection> {
Widget build(BuildContext context) {
final params = ref.watch(paramsProvider);
final generationState = ref.watch(generationProvider);
final isGenerating =
generationState.status == GenerationStatus.generating;
final isGenerating = generationState.status == GenerationStatus.generating;
final showScale = params.upscalerMode != 'None';

return Padding(
Expand All @@ -71,9 +70,7 @@ class _PostprocSectionState extends ConsumerState<PostprocSection> {
isExpanded: true,
isDense: true,
items: _previewModes
.map(
(m) => DropdownMenuItem(value: m, child: Text(m)),
)
.map((m) => DropdownMenuItem(value: m, child: Text(m)))
.toList(),
onChanged: isGenerating
? null
Expand Down Expand Up @@ -101,9 +98,7 @@ class _PostprocSectionState extends ConsumerState<PostprocSection> {
isExpanded: true,
isDense: true,
items: _upscalerModes
.map(
(m) => DropdownMenuItem(value: m, child: Text(m)),
)
.map((m) => DropdownMenuItem(value: m, child: Text(m)))
.toList(),
onChanged: isGenerating
? null
Expand All @@ -128,17 +123,16 @@ class _PostprocSectionState extends ConsumerState<PostprocSection> {
labelText: 'Scale factor',
border: OutlineInputBorder(),
),
keyboardType:
const TextInputType.numberWithOptions(decimal: true),
keyboardType: const TextInputType.numberWithOptions(
decimal: true,
),
inputFormatters: [
FilteringTextInputFormatter.allow(RegExp(r'^\d*\.?\d*')),
],
onChanged: (value) {
final parsed = double.tryParse(value);
if (parsed != null && parsed > 0) {
ref
.read(paramsProvider.notifier)
.setUpscalerScale(parsed);
ref.read(paramsProvider.notifier).setUpscalerScale(parsed);
}
},
),
Expand Down
5 changes: 5 additions & 0 deletions src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,10 @@ pub struct ModelConfig {
#[builder(default = "false")]
stream_layers: bool,

/// Load all params into the params backend at model-load time instead of lazily on first use (defaults to false)
#[builder(default = "false")]
eager_load: bool,

#[builder(default = "None", private)]
upscaler_ctx: Option<*mut upscaler_ctx_t>,

Expand Down Expand Up @@ -861,6 +865,7 @@ impl ModelConfig {
stream_layers: self.stream_layers,
rpc_servers: null(),
pulid_weights_path: self.pulid_weights_path.as_ptr(),
eager_load: self.eager_load,
};
let ctx = new_sd_ctx(&sd_ctx_params);
self.diffusion_ctx = Some((ctx, sd_ctx_params))
Expand Down
Loading