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

Port to diffusers pipeline #1

Merged
merged 41 commits into from
Dec 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
d2f2a2c
use poetry instead of `requirements.txt`
shunk031 Dec 20, 2022
085dd92
update gitignore
shunk031 Dec 20, 2022
bd15d35
remove `runner.py`
shunk031 Dec 20, 2022
2074123
port `inj_forward` to `attention.py`
shunk031 Dec 20, 2022
45727ff
add pipeline for paint with words
shunk031 Dec 20, 2022
1d015db
add test for the pipeline
shunk031 Dec 20, 2022
a76effe
port `_image_context_seperator` to the pipeline
shunk031 Dec 20, 2022
6ee8ee0
port to `replace_cross_attention`
shunk031 Dec 20, 2022
85ac872
port `_tokens_img_attention_weight` to the pipeline
shunk031 Dec 20, 2022
67738f5
port `_img_importance_flatten` to `images.py`
shunk031 Dec 20, 2022
8b85581
remove `.env.example`
shunk031 Dec 20, 2022
8a9becc
add weight functions
shunk031 Dec 20, 2022
40367f4
rename `inj_forward` to `paint_with_words_forward` and update the imp…
shunk031 Dec 20, 2022
5298b74
update the pipeline with `paint_with_words_forward`
shunk031 Dec 20, 2022
e4f1b64
replace scheduler and add some comments
shunk031 Dec 20, 2022
0537cc8
remove `change_model_path.py`
shunk031 Dec 20, 2022
f387766
rename `_image_context_seperator` to `separate_image_context` and ref…
shunk031 Dec 20, 2022
bf2fc51
rename `_tokens_img_attention_weight` to `calculate_tokens_image_atte…
shunk031 Dec 20, 2022
3e2f25f
rename `_img_importance_flatten` to `flatten_image_importance` and re…
shunk031 Dec 20, 2022
ab4d060
remove unused imports
shunk031 Dec 20, 2022
51e8644
remove `paint_with_words.py` and update to add `__call__` method in t…
shunk031 Dec 20, 2022
a6d7145
remove `utils.py`
shunk031 Dec 20, 2022
a4563aa
remove setup.py
shunk031 Dec 20, 2022
b9e8ed4
update test for the pipeline
shunk031 Dec 20, 2022
37d5c9e
add setting for CI
shunk031 Dec 20, 2022
114b5bd
change branch name
shunk031 Dec 20, 2022
3b64f04
support python 3.8
shunk031 Dec 20, 2022
61f06f5
remove duplicated weighted functions
shunk031 Dec 20, 2022
8736275
update README.md
shunk031 Dec 20, 2022
6072c2a
remove unused import
shunk031 Dec 20, 2022
8952a19
update for loading color map image
shunk031 Dec 20, 2022
666f588
add test for the aliases
shunk031 Dec 20, 2022
49f76b4
update for loading image
shunk031 Dec 20, 2022
cf750f3
update the pipeline
shunk031 Dec 20, 2022
679871a
add file
shunk031 Dec 20, 2022
a36a213
use `pipe.load_image` in the tests
shunk031 Dec 20, 2022
c7519d8
add ftfy
shunk031 Dec 20, 2022
df55a03
update to use torch.float16
shunk031 Dec 20, 2022
810d19b
update tests for images
shunk031 Dec 20, 2022
da77b79
update README
shunk031 Dec 20, 2022
d060505
fix test case
shunk031 Dec 20, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .env.example

This file was deleted.

52 changes: 52 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: CI

on:
push:
branches: [master]
pull_request:
branches: [master]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10']

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .
- name: Format
run: |
pip install black
black --check .
- name: Lint
run: |
pip install flake8
flake8 . --ignore=E501,W503,E203
- name: Type check
run: |
pip install mypy
mypy . \
--ignore-missing-imports \
--no-strict-optional \
--no-site-packages \
--cache-dir=/dev/null

- name: Login huggingface hub
env:
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
run: |
python -c 'from huggingface_hub import HfFolder; import os; HfFolder.save_token(os.environ["ACCESS_TOKEN"])'
- name: Run tests
run: |
pip install pytest
pytest --color=yes -rf
175 changes: 170 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,171 @@
_debug*
# Created by https://www.toptal.com/developers/gitignore/api/python
# Edit at https://www.toptal.com/developers/gitignore?templates=python

### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
__pycache__
_sc.py
*.ckpt
*.bin
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

### Python Patch ###
# Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration
poetry.toml


# End of https://www.toptal.com/developers/gitignore/api/python
Loading