Skip to content
This repository has been archived by the owner on Nov 21, 2023. It is now read-only.

Commit

Permalink
#12 fix diffusers checking repository
Browse files Browse the repository at this point in the history
  • Loading branch information
rbourgeat committed Jul 9, 2023
1 parent 23b6039 commit 24cef9a
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 13 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/markdown_lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Markdown Lint

on: [push]

jobs:
lint:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '14'

- name: Install dependencies
run: npm install

- name: Run Markdown lint
run: npx markdownlint '**/*.md'
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ For now, Mac & Linux:

You can custom global variables at the top of `app/run.py` as you want.

For increase performance, you can reduce the generated images size for exemple.
For increase performance, you can reduce the generated images size
(height and)

🖍️ Note: the output images folder is in `app/images/`

Expand Down
37 changes: 25 additions & 12 deletions app/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@
import spacy
from diffusers import DiffusionPipeline, DPMSolverMultistepScheduler

#########################################################
# You can edit the following values: #
SD_MODEL = "Lykon/DreamShaper" # any HuggingFace model #
SD_HEIGHT = 768 # image size #
SD_WIDTH = 512 #
SD_STEPS = 25 # number of image iteration #
CUSTOM = True # if True, you need to introduce your rp #
LIGHT_MODE = True # if True dont check vram and use 7B #
#########################################################
#############################################################
# You can edit the following values:
SD_MODEL = "Lykon/DreamShaper" # any HuggingFace model
SD_HEIGHT = 768 # image size
SD_WIDTH = 512
SD_STEPS = 25 # number of image iteration
CUSTOM = False # if True, you need to introduce your rp
LIGHT_MODE = False # if True dont check vram and use 7B model
##############################################################

PROCESS = None
MODEL_7B = "llama.cpp/models/WizardLM-7B-V1.0-Uncensored/ggml-model-q4_0.bin"
Expand All @@ -44,9 +44,22 @@
nlp = spacy.load("en_core_web_sm")

dpm = DPMSolverMultistepScheduler.from_pretrained(SD_MODEL, subfolder="scheduler")
pipe = DiffusionPipeline.from_pretrained(
SD_MODEL, scheduler=dpm, safety_checker=None, requires_safety_checker=False
)
pipe = None # pylint: disable=invalid-name
try:
pipe = DiffusionPipeline.from_pretrained(
SD_MODEL,
scheduler=dpm,
safety_checker=None,
requires_safety_checker=False,
local_files_only=True,
)
# pylint: disable=broad-exception-caught
except Exception as e:
print("An error occurred:", str(e))
pipe = DiffusionPipeline.from_pretrained(
SD_MODEL, scheduler=dpm, safety_checker=None, requires_safety_checker=False
)

if system == "Darwin":
pipe = pipe.to("mps")
else:
Expand Down

0 comments on commit 24cef9a

Please sign in to comment.