Add pre-commit.

This commit is contained in:
Hameer Abbasi
2023-08-21 10:23:08 +00:00
committed by Hameer Abbasi
parent e05a503bf4
commit 4c7792ed01
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
cache: pip
cache-dependency-path: requirements.txt
- name: run-ruff
- name: install-pylint
run: |
python -m pip install --upgrade pip
pip install ruff
ruff .
# - name: run-pylint
# run: |
# python -m pip install --upgrade pip
# pip install pylint
# pylint $(git ls-files '*.py')
pip install pylint
- name: pre-commit
uses: pre-commit-ci/lite-action@v1.0.1
if: always()
with:
msg: apply code formatting and linting auto-fixes
- name: test-startup
run: |
export COMMANDLINE_ARGS="--debug --test"

1
.gitignore vendored
View File

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

2
.gitmodules vendored
View File

@@ -33,7 +33,7 @@
url = https://github.com/KohakuBlueleaf/a1111-sd-webui-lycoris
ignore = dirty
[submodule "extensions-builtin/multidiffusion-upscaler-for-automatic1111"]
path = extensions-builtin/multidiffusion-upscaler-for-automatic1111
path = extensions-builtin/multidiffusion-upscaler-for-automatic1111
url = https://github.com/pkuliyi2015/multidiffusion-upscaler-for-automatic1111
ignore = dirty
[submodule "extensions-builtin/sd-webui-agent-scheduler"]

View File

@@ -6,4 +6,4 @@
"MD033": false,
"MD036": false,
"MD041": false
}
}

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`
- Support for multiple backends!
**original** and **diffusers**
<<<<<<< HEAD
<<<<<<< HEAD
- Support for multiple diffusion models!
Stable Diffusion, SD-XL, Kandinsky, DeepFloyd IF, etc.
- 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
- Built in installer with automatic updates and dependency management
- 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

View File

@@ -69,4 +69,4 @@ model:
cond_stage_config:
target: modules.xlmr.BertSeriesModelWithTransformation
params:
name: "XLMR-Large"
name: "XLMR-Large"

View File

@@ -65,4 +65,4 @@ model:
target: ldm.modules.encoders.modules.FrozenOpenCLIPEmbedder
params:
freeze: True
layer: "penultimate"
layer: "penultimate"

View File

@@ -687,4 +687,4 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
</pre>
</pre>

View File

@@ -119,7 +119,7 @@ svg.feather.feather-image, .feather .feather-image { display: none }
#txt2img_subseed_strength { margin-top: 0; }
#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, #img2img_tools { margin-top: -4px; margin-bottom: -4px; }
#txt2img_tools, #img2img_tools { margin-top: -4px; margin-bottom: -4px; }
#txt2img_styles_row { margin-top: -6px; }
/* custom elements overrides */
@@ -322,4 +322,3 @@ svg.feather.feather-image, .feather .feather-image { display: none }
--size-9: 64px;
--size-14: 64px;
}

View File

@@ -114,8 +114,8 @@ svg.feather.feather-image, .feather .feather-image { display: none }
#txt2img_settings { min-width: var(--left-column); max-width: var(--left-column); background-color: #111111; padding-top: 16px; }
#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, #img2img_tools { margin-top: -4px; margin-bottom: -4px; }
#txt2img_styles_row, #img2img_styles_row { margin-top: -6px; }
#txt2img_tools, #img2img_tools { margin-top: -4px; margin-bottom: -4px; }
#txt2img_styles_row { margin-top: -6px; }
/* custom elements overrides */
#steps-animation, #controlnet { border-width: 0; }

View File

@@ -113,7 +113,7 @@ function createPanZoom(domElement, options) {
dispose: dispose,
moveBy: internalMoveBy,
moveTo: moveTo,
smoothMoveTo: smoothMoveTo,
smoothMoveTo: smoothMoveTo,
centerOn: centerOn,
zoomTo: publicZoomTo,
zoomAbs: zoomAbs,
@@ -141,7 +141,7 @@ function createPanZoom(domElement, options) {
};
eventify(api);
var initialX = typeof options.initialX === 'number' ? options.initialX : transform.x;
var initialY = typeof options.initialY === 'number' ? options.initialY : transform.y;
var initialZoom = typeof options.initialZoom === 'number' ? options.initialZoom : transform.scale;
@@ -1049,7 +1049,7 @@ function autoRun() {
}
autoRun();
},{"./lib/createTextSelectionInterceptor.js":2,"./lib/domController.js":3,"./lib/kinetic.js":4,"./lib/svgController.js":5,"./lib/transform.js":6,"amator":7,"ngraph.events":9,"wheel":10}],2:[function(require,module,exports){
/**
* Disallows selecting text.
@@ -1087,7 +1087,7 @@ function createTextSelectionInterceptor(useFake) {
function release() {
if (!wasCaptured) return;
wasCaptured = false;
window.document.onselectstart = prevSelectStart;
if (dragObject) dragObject.ondragstart = prevDragStart;
@@ -1107,14 +1107,14 @@ module.exports = makeDomController
module.exports.canAttach = isDomElement;
function makeDomController(domElement, options) {
var elementValid = isDomElement(domElement);
var elementValid = isDomElement(domElement);
if (!elementValid) {
throw new Error('panzoom requires DOM element to be attached to the DOM tree')
}
var owner = domElement.parentElement;
domElement.scrollTop = 0;
if (!options.disableKeyboardInteraction) {
owner.setAttribute('tabindex', 0);
}
@@ -1124,7 +1124,7 @@ function makeDomController(domElement, options) {
getOwner: getOwner,
applyTransform: applyTransform,
}
return api
function getOwner() {
@@ -1320,7 +1320,7 @@ function makeSvgController(svgElement, options) {
applyTransform: applyTransform,
initTransform: initTransform
}
return api
function getOwner() {

View File

@@ -95,7 +95,7 @@ def directml_override_opts():
if item.message is not None:
shared.log.warning(item.message)
shared.log.warning(f'{key} is automatically overriden to {item.value}.')
if count > 0:
shared.log.info(f'{count} options are automatically overriden. If you want to keep them from overriding, run with --experimental argument.')

View File

@@ -26,7 +26,7 @@ class ATIADLxx(object):
if ADL2_Adapter_MemoryInfo2_Get(self.context, adapterIndex, C.byref(info)) != ADL_OK:
raise RuntimeError("ADL2: Failed to get MemoryInfo2")
return info
def get_dedicated_vram_usage(self, index: int) -> int:

View File

@@ -1 +1 @@
ADL_OK = 0
ADL_OK = 0

View File

@@ -84,4 +84,4 @@ _AdapterInfo._fields_ = [
AdapterInfo = _AdapterInfo
LPAdapterInfo = C.POINTER(_AdapterInfo)
ADL_CONTEXT_HANDLE = C.c_void_p
ADL_CONTEXT_HANDLE = C.c_void_p

View File

@@ -16,13 +16,13 @@ class CondFunc:
orig_func = getattr(resolved_obj, func_path[-1])
setattr(resolved_obj, func_path[-1], lambda *args, **kwargs: self(*args, **kwargs))
self.__init__(orig_func, sub_func, cond_func)
return lambda *args, **kwargs: self(*args, **kwargs)
def __init__(self, orig_func, sub_func, cond_func):
self.__orig_func = orig_func
self.__sub_func = sub_func
self.__cond_func = cond_func
def __call__(self, *args, **kwargs):
if not self.__cond_func or self.__cond_func(self.__orig_func, *args, **kwargs):
return self.__sub_func(self.__orig_func, *args, **kwargs)
else:
return self.__orig_func(*args, **kwargs)
return lambda *args, **kwargs: self(*args, **kwargs)
def __init__(self, orig_func, sub_func, cond_func):
self.__orig_func = orig_func
self.__sub_func = sub_func
self.__cond_func = cond_func
def __call__(self, *args, **kwargs):
if not self.__cond_func or self.__cond_func(self.__orig_func, *args, **kwargs):
return self.__sub_func(self.__orig_func, *args, **kwargs)
else:
return self.__orig_func(*args, **kwargs)

View File

@@ -30,7 +30,7 @@ class LearnScheduleIterator:
return
assert self.rates
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):
@@ -75,4 +75,3 @@ class LearnRateScheduler:
for pg in optimizer.param_groups:
pg['lr'] = self.learn_rate

View File

@@ -1 +1 @@
a painting, art by [name]
a painting, art by [name]

View File

@@ -1 +1 @@
photo of [filewords], art by [name]
photo of [filewords], art by [name]

View File

@@ -1 +1 @@
photo of [name]
photo of [name]

View File

@@ -1 +1 @@
photo of [name], [filewords]
photo of [name], [filewords]

View File

@@ -1 +1 @@
[name]
[name]

View File

@@ -1 +1 @@
[name], [filewords]
[name], [filewords]