Add pre-commit.

pull/2052/head
Hameer Abbasi 2023-08-21 10:23:08 +00:00 committed by Hameer Abbasi
parent e05a503bf4
commit 4c7792ed01
No known key found for this signature in database
GPG Key ID: BA01600C510C2328
25 changed files with 144 additions and 47 deletions

1
.git-blame-ignore-revs Normal file
View File

@ -0,0 +1 @@
522dc5b4ff2a61e576aa9fb4ac3ab9274d4f26dd

View File

@ -16,16 +16,15 @@ jobs:
python-version: 3.10.6 python-version: 3.10.6
cache: pip cache: pip
cache-dependency-path: requirements.txt cache-dependency-path: requirements.txt
- name: run-ruff - name: install-pylint
run: | run: |
python -m pip install --upgrade pip python -m pip install --upgrade pip
pip install ruff pip install pylint
ruff . - name: pre-commit
# - name: run-pylint uses: pre-commit-ci/lite-action@v1.0.1
# run: | if: always()
# python -m pip install --upgrade pip with:
# pip install pylint msg: apply code formatting and linting auto-fixes
# pylint $(git ls-files '*.py')
- name: test-startup - name: test-startup
run: | run: |
export COMMANDLINE_ARGS="--debug --test" export COMMANDLINE_ARGS="--debug --test"

1
.gitignore vendored
View File

@ -16,6 +16,7 @@ package-lock.json
venv venv
.history .history
cache cache
**/.DS_Store
# all models and temp files # all models and temp files
*.log *.log

66
.pre-commit-config.yaml Normal file
View File

@ -0,0 +1,66 @@
# To use:
#
# pre-commit run -a
#
# Or:
#
# pre-commit install # (runs every time you commit in git)
#
# To update this file:
#
# pre-commit autoupdate
#
# See https://github.com/pre-commit/pre-commit
ci:
autoupdate_commit_msg: "chore: update pre-commit hooks"
autofix_commit_msg: "style: pre-commit fixes"
repos:
# Standard hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
- id: check-merge-conflict
- id: check-symlinks
- id: check-yaml
args: ["--allow-multiple-documents"]
- id: debug-statements
- id: end-of-file-fixer
- id: mixed-line-ending
- id: trailing-whitespace
exclude: |
(?x)^(
.*\.md|
.github/ISSUE_TEMPLATE/.*\.yml
)$
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: 'v0.0.285'
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- repo: local
hooks:
- id: pylint
name: pylint
entry: pylint
language: system
types: [python]
args: []
# Black, the code formatter, natively supports pre-commit
# - repo: https://github.com/psf/black
# rev: 23.7.0
# hooks:
# - id: black
# exclude: ^(docs)
# Changes tabs to spaces
# - repo: https://github.com/Lucas-C/pre-commit-hooks
# rev: v1.5.3
# hooks:
# - id: remove-tabs
# exclude: ^(docs)

View File

@ -26,6 +26,8 @@ All Individual features are not listed here, instead check [ChangeLog](CHANGELOG
Including built-in support for `torch.compile` Including built-in support for `torch.compile`
- Support for multiple backends! - Support for multiple backends!
**original** and **diffusers** **original** and **diffusers**
<<<<<<< HEAD
<<<<<<< HEAD
- Support for multiple diffusion models! - Support for multiple diffusion models!
Stable Diffusion, SD-XL, Kandinsky, DeepFloyd IF, etc. Stable Diffusion, SD-XL, Kandinsky, DeepFloyd IF, etc.
- Fully multiplatform with platform specific autodetection and tuning performed on install - Fully multiplatform with platform specific autodetection and tuning performed on install
@ -39,6 +41,36 @@ All Individual features are not listed here, instead check [ChangeLog](CHANGELOG
- Broad compatibility with existing extensions ecosystem and new extensions manager - Broad compatibility with existing extensions ecosystem and new extensions manager
- Built in installer with automatic updates and dependency management - Built in installer with automatic updates and dependency management
- Modernized UI (still based on Gradio) with theme support - Modernized UI (still based on Gradio) with theme support
=======
- Support for multiple diffusion models!
Stable Diffusion, SD-XL, Kandinsky, DeepFloyd IF, etc.
- Fully multiplatform with platform specific autodetection and tuning performed on install
Windows / Linux / MacOS with CPU / nVidia / AMD / IntelArc / DirectML
- Improved prompt parser
- Enhanced *Lora*/*Locon*/*Lyco* code supporting latest trends in training
- Built-in queue management
- Advanced metadata caching and handling to speed up operations
- Enterprise level logging and hardened API
- Modern localization and hints engine
- Broad compatibility with existing extensions ecosystem and new extensions manager
- Built in installer with automatic updates and dependency management
- Modernized UI (still based on Gradio) with theme support
>>>>>>> 26aee894 (Add pre-commit.)
=======
- Support for multiple diffusion models!
Stable Diffusion, SD-XL, Kandinsky, DeepFloyd IF, etc.
- Fully multiplatform with platform specific autodetection and tuning performed on install
Windows / Linux / MacOS with CPU / nVidia / AMD / Intel / DirectML
- Improved prompt parser
- Enhanced *Lora*/*Locon*/*Lyco* code supporting latest trends in training
- Built-in queue management
- Advanced metadata caching and handling to speed up operations
- Enterprise level logging and hardened API
- Modern localization and hints engine
- Broad compatibility with existing extensions ecosystem and new extensions manager
- Built in installer with automatic updates and dependency management
- Modernized UI (still based on Gradio) with theme support
>>>>>>> 75d5f19f (Exclude *.md from trailing-whitespace hook.)
## Backend support ## Backend support

View File

@ -322,4 +322,3 @@ svg.feather.feather-image, .feather .feather-image { display: none }
--size-9: 64px; --size-9: 64px;
--size-14: 64px; --size-14: 64px;
} }

View File

@ -115,7 +115,7 @@ svg.feather.feather-image, .feather .feather-image { display: none }
#pnginfo_html2_info { margin-top: -18px; background-color: var(--input-background-fill); padding: var(--input-padding) } #pnginfo_html2_info { margin-top: -18px; background-color: var(--input-background-fill); padding: var(--input-padding) }
#txt2img_tools > div > button, #img2img_tools > div > button { filter: hue-rotate(180deg) saturate(0.5); } #txt2img_tools > div > button, #img2img_tools > div > button { filter: hue-rotate(180deg) saturate(0.5); }
#txt2img_tools, #img2img_tools { margin-top: -4px; margin-bottom: -4px; } #txt2img_tools, #img2img_tools { margin-top: -4px; margin-bottom: -4px; }
#txt2img_styles_row, #img2img_styles_row { margin-top: -6px; } #txt2img_styles_row { margin-top: -6px; }
/* custom elements overrides */ /* custom elements overrides */
#steps-animation, #controlnet { border-width: 0; } #steps-animation, #controlnet { border-width: 0; }

View File

@ -30,7 +30,7 @@ class LearnScheduleIterator:
return return
assert self.rates assert self.rates
except (ValueError, AssertionError) as e: except (ValueError, AssertionError) as e:
raise Exception('Invalid learning rate schedule. It should be a number or, for example, like "0.001:100, 0.00001:1000, 1e-5:10000" to have lr of 0.001 until step 100, 0.00001 until 1000, and 1e-5 until 10000.') from e raise RuntimeError('Invalid learning rate schedule. It should be a number or, for example, like "0.001:100, 0.00001:1000, 1e-5:10000" to have lr of 0.001 until step 100, 0.00001 until 1000, and 1e-5 until 10000.') from e
def __iter__(self): def __iter__(self):
@ -75,4 +75,3 @@ class LearnRateScheduler:
for pg in optimizer.param_groups: for pg in optimizer.param_groups:
pg['lr'] = self.learn_rate pg['lr'] = self.learn_rate