Skip to content

Commit

Permalink
Move cfg scale out of diffusers block
Browse files Browse the repository at this point in the history
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
  • Loading branch information
mudler committed Dec 2, 2024
1 parent 354928b commit 606f215
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 14 deletions.
2 changes: 1 addition & 1 deletion core/backend/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ func grpcModelOpts(c config.BackendConfig) *pb.ModelOptions {
CUDA: c.CUDA || c.Diffusers.CUDA,
SchedulerType: c.Diffusers.SchedulerType,
PipelineType: c.Diffusers.PipelineType,
CFGScale: c.Diffusers.CFGScale,
CFGScale: c.CFGScale,
LoraAdapter: c.LoraAdapter,
LoraScale: c.LoraScale,
LoraAdapters: c.LoraAdapters,
Expand Down
21 changes: 11 additions & 10 deletions core/config/backend_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,16 +99,15 @@ type GRPC struct {
}

type Diffusers struct {
CUDA bool `yaml:"cuda"`
PipelineType string `yaml:"pipeline_type"`
SchedulerType string `yaml:"scheduler_type"`
EnableParameters string `yaml:"enable_parameters"` // A list of comma separated parameters to specify
CFGScale float32 `yaml:"cfg_scale"` // Classifier-Free Guidance Scale
IMG2IMG bool `yaml:"img2img"` // Image to Image Diffuser
ClipSkip int `yaml:"clip_skip"` // Skip every N frames
ClipModel string `yaml:"clip_model"` // Clip model to use
ClipSubFolder string `yaml:"clip_subfolder"` // Subfolder to use for clip model
ControlNet string `yaml:"control_net"`
CUDA bool `yaml:"cuda"`
PipelineType string `yaml:"pipeline_type"`
SchedulerType string `yaml:"scheduler_type"`
EnableParameters string `yaml:"enable_parameters"` // A list of comma separated parameters to specify
IMG2IMG bool `yaml:"img2img"` // Image to Image Diffuser
ClipSkip int `yaml:"clip_skip"` // Skip every N frames
ClipModel string `yaml:"clip_model"` // Clip model to use
ClipSubFolder string `yaml:"clip_subfolder"` // Subfolder to use for clip model
ControlNet string `yaml:"control_net"`
}

// LLMConfig is a struct that holds the configuration that are
Expand Down Expand Up @@ -166,6 +165,8 @@ type LLMConfig struct {
YarnAttnFactor float32 `yaml:"yarn_attn_factor"`
YarnBetaFast float32 `yaml:"yarn_beta_fast"`
YarnBetaSlow float32 `yaml:"yarn_beta_slow"`

CFGScale float32 `yaml:"cfg_scale"` // Classifier-Free Guidance Scale
}

// AutoGPTQ is a struct that holds the configuration specific to the AutoGPTQ backend
Expand Down
6 changes: 4 additions & 2 deletions docs/content/docs/features/image-generation.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,9 @@ diffusers:
pipeline_type: StableDiffusionPipeline
enable_parameters: "negative_prompt,num_inference_steps,clip_skip"
scheduler_type: "k_dpmpp_sde"
cfg_scale: 8
clip_skip: 11
cfg_scale: 8
```

#### Configuration parameters
Expand Down Expand Up @@ -302,7 +303,8 @@ cuda: true
diffusers:
pipeline_type: StableDiffusionDepth2ImgPipeline
enable_parameters: "negative_prompt,num_inference_steps,image"
cfg_scale: 6
cfg_scale: 6
```

```bash
Expand Down
3 changes: 2 additions & 1 deletion gallery/flux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ config_file: |
cuda: true
enable_parameters: num_inference_steps
pipeline_type: FluxPipeline
cfg_scale: 0
cfg_scale: 0

0 comments on commit 606f215

Please sign in to comment.