Skip to content

Commit

Permalink
Lora schnell steps (#42)
Browse files Browse the repository at this point in the history
* now with num_inference_steps
  • Loading branch information
daanelson authored Nov 1, 2024
1 parent 83c440c commit 622659d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ __pycache__
/model-cache
/safety-cache
/falcon-cache

14 changes: 9 additions & 5 deletions predict.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,11 @@ class SharedInputs:
description="Load LoRA weights. Supports Replicate models in the format <owner>/<username> or <owner>/<username>/<version>, HuggingFace URLs in the format huggingface.co/<owner>/<model-name>, CivitAI URLs in the format civitai.com/models/<id>[/<model-name>], or arbitrary .safetensors URLs from the Internet. For example, 'fofr/flux-pixar-cars'",
default=None,
)
lora_scale: Input = (
Input(
lora_scale: Input = Input(
description="Determines how strongly the main LoRA should be applied. Sane results between 0 and 1 for base inference. For go_fast we apply a 1.5x multiplier to this value; we've generally seen good performance when scaling the base value by that amount. You may still need to experiment to find the best value for your particular lora.",
default=1.0,
le=5.0,
ge=-5.0,
),
)
megapixels: Input = Input(
description="Approximate number of megapixels for generated image",
Expand Down Expand Up @@ -642,6 +640,12 @@ def predict(
prompt: str = SHARED_INPUTS.prompt,
aspect_ratio: str = SHARED_INPUTS.aspect_ratio,
num_outputs: int = SHARED_INPUTS.num_outputs,
num_inference_steps: int = Input(
description="Number of denoising steps. 4 is recommended, and lower number of steps produce lower quality outputs, faster.",
ge=1,
le=4,
default=4,
),
seed: int = SHARED_INPUTS.seed,
output_format: str = SHARED_INPUTS.output_format,
output_quality: int = SHARED_INPUTS.output_quality,
Expand All @@ -657,15 +661,15 @@ def predict(
prompt,
aspect_ratio,
num_outputs,
num_inference_steps=self.num_steps,
num_inference_steps=num_inference_steps,
seed=seed,
)
else:
imgs, np_imgs = self.base_predict(
prompt,
aspect_ratio,
num_outputs,
num_inference_steps=self.num_steps,
num_inference_steps=num_inference_steps,
seed=seed,
)

Expand Down

0 comments on commit 622659d

Please sign in to comment.