Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: large refactor - breaking changes #413

Merged
merged 10 commits into from
Dec 13, 2023
Merged

Conversation

brycedrennan
Copy link
Owner

@brycedrennan brycedrennan commented Dec 8, 2023

  • Converted several constant classes to Enums (MaskMode for example)
  • Renamed ControlNetInput to ControlInput in anticipation of other forms of control
  • ImaginePrompt.model => ImaginePrompt.model_weights
  • ImaginePrompt.model_config_path => ImaginePrompt.model_architecture
  • added ImaginePrompt.size and --size field to specify image dimensions, supporting various formats. Removed width and height parameters.
  • normalize_image_size function converts various ways someone could specify "size" to (width, height) tuple. ("512", "4k", "1024,1024" etc)
  • Transitioned from samplers to solvers terminology (in diffusers called a "scheduler". In automatic1111, a "sampler")
  • Changed solver type alias to 'DPMPP' since it doesn't use karras schedule.
  • Added typing information various places
  • Fixed ImaginePrompt so type hints work.

@brycedrennan brycedrennan force-pushed the bd/arch-param branch 2 times, most recently from 0176db8 to 079273e Compare December 8, 2023 06:51
- add type hints
- size parameter
- ControlNetInput => ControlInput
- simplify imagineresult
@brycedrennan brycedrennan changed the title change everything! feature: large refactor - breaking changes Dec 9, 2023
@brycedrennan brycedrennan marked this pull request as ready for review December 9, 2023 21:25
# kdiff.DPMFastSampler,
# kdiff.DPMAdaptiveSampler,
# kdiff.LMSSampler,
# kdiff.DPM2Sampler,
# kdiff.DPM2AncestralSampler,
kdiff.DPMPP2MSampler,
# kdiff.DPMPP2MSampler,
# kdiff.DPMPP2SAncestralSampler,
# kdiff.EulerSampler,
# kdiff.EulerAncestralSampler,
# kdiff.HeunSampler,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete?

# class DPM2AncestralSampler(KDiffusionSampler):
# short_name = SamplerName.K_DPM_2_ANCESTRAL
# class DPM2AncestralSampler(KDiffusionSolver):
# short_name = SolverName.K_DPM_2_ANCESTRAL
# name = "Diffusion probabilistic models - 2 ancestral"
# default_steps = 40
# sampler_func = staticmethod(k_sampling.sample_dpm_2_ancestral)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete?

# class HeunSampler(KDiffusionSampler):
# short_name = SamplerName.K_HEUN
# class HeunSampler(KDiffusionSolver):
# short_name = SolverName.K_HEUN
# name = "Algorithm 2 (Heun steps) from Karras et al. (2022)."
# default_steps = 40
# sampler_func = staticmethod(k_sampling.sample_heun)
#
#
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete?

# if get_device() == "mps:0":
# SOLVERS_FOR_TESTING = ["plms", "k_euler_a"]
# elif get_device() == "cpu":
# SOLVERS_FOR_TESTING = []
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete?

# from imaginairy.samplers import SOLVER_TYPE_OPTIONS
#
#
# def test_sampler_options():
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete?

@@ -58,7 +59,7 @@ def test_clip_masking(filename_base_for_outputs):
upscale=False,
fix_faces=True,
seed=42,
# sampler_type="plms",
# solver_type="plms",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete?

@brycedrennan brycedrennan force-pushed the bd/arch-param branch 5 times, most recently from 824771d to f714ddc Compare December 13, 2023 02:15
- do not provide automatically imported api functions and objects in `imaginairy` root module
- horrible hack to overcome horrible design choices by easy_install/setuptools

The hack modifies the installed script to remove the __import__ pkg_resources line

If we don't do this then the scripts will be slow to start up because of
pkg_resources.require() which is called by setuptools to ensure the
"correct" version of the package is installed.

before modification example:
```
__requires__ = 'imaginAIry==14.0.0b5'
__import__('pkg_resources').require('imaginAIry==14.0.0b5')
__file__ = '/home/user/projects/imaginairy/imaginairy/bin/aimg'
with open(__file__) as f:
    exec(compile(f.read(), __file__, 'exec'))
```
- fix colorize cmd. add test
- fix describe cmd. add test
- fix model-list cmd. add test
- fix stable studio
- hide stack grace for ValueErrors in cli
- set controlnet scale
- fix negative prompt to allow emptystring instead of replacing it with default
- adjust edit-demo parameters
- arg scheduler that works at click level (but disable it). works but not ideal experience.
fix some typehint issues
@brycedrennan brycedrennan merged commit 62de446 into master Dec 13, 2023
4 checks passed
@brycedrennan brycedrennan deleted the bd/arch-param branch December 13, 2023 04:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants