Skip to content

Commit 59ec427

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents fd66f66 + b08698a commit 59ec427

File tree

13 files changed

+172
-52
lines changed

13 files changed

+172
-52
lines changed

launch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ def prepare_enviroment():
142142

143143
stable_diffusion_commit_hash = os.environ.get('STABLE_DIFFUSION_COMMIT_HASH', "69ae4b35e0a0f6ee1af8bb9a5d0016ccb27e36dc")
144144
taming_transformers_commit_hash = os.environ.get('TAMING_TRANSFORMERS_COMMIT_HASH', "24268930bf1dce879235a7fddd0b2355b84d7ea6")
145-
k_diffusion_commit_hash = os.environ.get('K_DIFFUSION_COMMIT_HASH', "f4e99857772fc3a126ba886aadf795a332774878")
145+
k_diffusion_commit_hash = os.environ.get('K_DIFFUSION_COMMIT_HASH', "60e5042ca0da89c14d1dd59d73883280f8fce991")
146146
codeformer_commit_hash = os.environ.get('CODEFORMER_COMMIT_HASH', "c5b4593074ba6214284d6acd5f1719b6c5d739af")
147147
blip_commit_hash = os.environ.get('BLIP_COMMIT_HASH', "48211a1594f1321b00f14c9f7a5b4813144b2fb9")
148148

localizations/ko_KR.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"A merger of the two checkpoints will be generated in your": "체크포인트들이 병합된 결과물이 당신의",
1717
"A value that determines the output of random number generator - if you create an image with same parameters and seed as another image, you'll get the same result": "난수 생성기의 결과물을 지정하는 값 - 동일한 설정값과 동일한 시드를 적용 시, 완전히 똑같은 결과물을 얻게 됩니다.",
1818
"Action": "작업",
19+
"Add a button to convert the prompts used in NovelAI for use in the WebUI. In addition, add a button that allows you to recall a previously used prompt.": "NovelAI에서 사용되는 프롬프트를 WebUI에서 사용할 수 있게 변환하는 버튼을 추가합니다. 덤으로 이전에 사용한 프롬프트를 불러오는 버튼도 추가됩니다.",
1920
"Add a random artist to the prompt.": "프롬프트에 랜덤한 작가 추가",
2021
"Add a second progress bar to the console that shows progress for an entire job.": "콘솔에 전체 작업의 진행도를 보여주는 2번째 프로그레스 바 추가하기",
2122
"Add difference": "차이점 추가",
@@ -24,6 +25,7 @@
2425
"Add model hash to generation information": "생성 정보에 모델 해시 추가",
2526
"Add model name to generation information": "생성 정보에 모델 이름 추가",
2627
"Add number to filename when saving": "이미지를 저장할 때 파일명에 숫자 추가하기",
28+
"Adds a tab that lets you preview how CLIP model would tokenize your text.": "CLIP 모델이 텍스트를 어떻게 토큰화할지 미리 보여주는 탭을 추가합니다.",
2729
"Adds a tab to the webui that allows the user to automatically extract keyframes from video, and manually extract 512x512 crops of those frames for use in model training.": "WebUI에 비디오로부터 자동으로 키프레임을 추출하고, 그 키프레임으로부터 모델 훈련에 사용될 512x512 이미지를 잘라낼 수 있는 탭을 추가합니다.",
2830
"Aesthetic Gradients": "스타일 그라디언트",
2931
"Aesthetic Image Scorer": "스타일 이미지 스코어러",
@@ -33,6 +35,7 @@
3335
"Aesthetic text for imgs": "스타일 텍스트",
3436
"Aesthetic weight": "스타일 가중치",
3537
"Allowed categories for random artists selection when using the Roll button": "랜덤 버튼을 눌러 무작위 작가를 선택할 때 허용된 카테고리",
38+
"Allows you to include various shortcodes in your prompts. You can pull text from files, set up your own variables, process text through conditional functions, and so much more - it's like wildcards on steroids.": "프롬프트에 다양한 숏코드를 추가할 수 있게 해줍니다. 파일로부터 텍스트 추출, 변수 설정, 조건 함수로 텍스트 처리 등등 - 스테로이드를 맞은 와일드카드라 할 수 있죠.",
3639
"Always print all generation info to standard output": "기본 아웃풋에 모든 생성 정보 항상 출력하기",
3740
"Always save all generated image grids": "생성된 이미지 그리드 항상 저장하기",
3841
"Always save all generated images": "생성된 이미지 항상 저장하기",
@@ -54,6 +57,7 @@
5457
"Batch Process": "이미지 여러장 처리",
5558
"Batch size": "배치 크기",
5659
"behind": "최신 아님",
60+
"Booru tag autocompletion": "Booru 태그 자동완성",
5761
"BSRGAN 4x": "BSRGAN 4x",
5862
"built with gradio": "gradio로 제작되었습니다",
5963
"Calculates aesthetic score for generated images using CLIP+MLP Aesthetic Score Predictor based on Chad Scorer": "Chad 스코어러를 기반으로 한 CLIP+MLP 스타일 점수 예측기를 이용해 생성된 이미지의 스타일 점수를 계산합니다.",
@@ -114,6 +118,7 @@
114118
"Directory for saving images using the Save button": "저장 버튼을 이용해 저장하는 이미지들의 저장 경로",
115119
"Directory name pattern": "디렉토리명 패턴",
116120
"directory.": "저장 경로에 저장됩니다.",
121+
"Displays autocompletion hints for tags from image booru boards such as Danbooru. Uses local tag CSV files and includes a config for customization.": "Danbooru 같은 이미지 booru 보드의 태그에 대한 자동완성 힌트를 보여줍니다. 로컬 환경에 저장된 CSV 파일을 사용하고 조정 가능한 설정 파일이 포함되어 있습니다.",
117122
"Do not add watermark to images": "이미지에 워터마크 추가하지 않기",
118123
"Do not do anything special": "아무것도 하지 않기",
119124
"Do not save grids consisting of one picture": "이미지가 1개뿐인 그리드는 저장하지 않기",
@@ -317,6 +322,7 @@
317322
"None": "없음",
318323
"Nothing": "없음",
319324
"Nothing found in the image.": "Nothing found in the image.",
325+
"novelai-2-local-prompt": "NovelAI 프롬프트 변환기",
320326
"Number of columns on the page": "각 페이지마다 표시할 가로줄 수",
321327
"Number of grids in each row": "각 세로줄마다 표시될 그리드 수",
322328
"number of images to delete consecutively next": "연속적으로 삭제할 이미지 수",
@@ -431,6 +437,7 @@
431437
"Save images with embedding in PNG chunks": "PNG 청크로 이미지에 임베딩을 포함시켜 저장",
432438
"Save style": "스타일 저장",
433439
"Save text information about generation parameters as chunks to png files": "이미지 생성 설정값을 PNG 청크에 텍스트로 저장",
440+
"Saves Optimizer state as separate *.optim file. Training can be resumed with HN itself and matching optim file.": "옵티마이저 상태를 별개의 *.optim 파일로 저장하기. 하이퍼네트워크 파일과 일치하는 optim 파일로부터 훈련을 재개할 수 있습니다.",
434441
"Saving images/grids": "이미지/그리드 저장",
435442
"Saving to a directory": "디렉토리에 저장",
436443
"Scale by": "스케일링 배수 지정",
@@ -515,6 +522,7 @@
515522
"Tile size for ESRGAN upscalers. 0 = no tiling.": "ESRGAN 업스케일러들의 타일 사이즈. 0 = 타일링 없음.",
516523
"Tiling": "타일링",
517524
"Time taken:": "소요 시간 : ",
525+
"tokenizer": "토크나이저",
518526
"Torch active/reserved:": "활성화/예약된 Torch 양 : ",
519527
"Torch active: Peak amount of VRAM used by Torch during generation, excluding cached data.\nTorch reserved: Peak amount of VRAM allocated by Torch, including all active and cached data.\nSys VRAM: Peak amount of VRAM allocation across all applications / total GPU VRAM (peak utilization%).": "활성화된 Torch : 생성 도중 캐시된 데이터를 포함해 사용된 VRAM의 최대량\n예약된 Torch : 활성화되고 캐시된 모든 데이터를 포함해 Torch에게 할당된 VRAM의 최대량\n시스템 VRAM : 모든 어플리케이션에 할당된 VRAM 최대량 / 총 GPU VRAM (최고 이용도%)",
520528
"Train": "훈련",

modules/api/api.py

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from modules.processing import StableDiffusionProcessingTxt2Img, StableDiffusionProcessingImg2Img, process_images
1111
from modules.sd_samplers import all_samplers
1212
from modules.extras import run_extras, run_pnginfo
13+
from PIL import PngImagePlugin
1314
from modules.sd_models import checkpoints_list
1415
from modules.realesrgan_model import get_realesrgan_models
1516
from typing import List
@@ -34,9 +35,21 @@ def setUpscalers(req: dict):
3435

3536

3637
def encode_pil_to_base64(image):
37-
buffer = io.BytesIO()
38-
image.save(buffer, format="png")
39-
return base64.b64encode(buffer.getvalue())
38+
with io.BytesIO() as output_bytes:
39+
40+
# Copy any text-only metadata
41+
use_metadata = False
42+
metadata = PngImagePlugin.PngInfo()
43+
for key, value in image.info.items():
44+
if isinstance(key, str) and isinstance(value, str):
45+
metadata.add_text(key, value)
46+
use_metadata = True
47+
48+
image.save(
49+
output_bytes, "PNG", pnginfo=(metadata if use_metadata else None)
50+
)
51+
bytes_data = output_bytes.getvalue()
52+
return base64.b64encode(bytes_data)
4053

4154

4255
class Api:
@@ -205,7 +218,7 @@ def interruptapi(self):
205218
shared.state.interrupt()
206219

207220
return {}
208-
221+
209222
def get_config(self):
210223
options = {}
211224
for key in shared.opts.data.keys():
@@ -214,10 +227,14 @@ def get_config(self):
214227
options.update({key: shared.opts.data.get(key, shared.opts.data_labels.get(key).default)})
215228
else:
216229
options.update({key: shared.opts.data.get(key, None)})
217-
230+
218231
return options
219-
232+
220233
def set_config(self, req: OptionsModel):
234+
# currently req has all options fields even if you send a dict like { "send_seed": false }, which means it will
235+
# overwrite all options with default values.
236+
raise RuntimeError('Setting options via API is not supported')
237+
221238
reqDict = vars(req)
222239
for o in reqDict:
223240
setattr(shared.opts, o, reqDict[o])
@@ -233,13 +250,13 @@ def get_samplers(self):
233250

234251
def get_upscalers(self):
235252
upscalers = []
236-
253+
237254
for upscaler in shared.sd_upscalers:
238255
u = upscaler.scaler
239256
upscalers.append({"name":u.name, "model_name":u.model_name, "model_path":u.model_path, "model_url":u.model_url})
240-
257+
241258
return upscalers
242-
259+
243260
def get_sd_models(self):
244261
return [{"title":x.title, "model_name":x.model_name, "hash":x.hash, "filename": x.filename, "config": x.config} for x in checkpoints_list.values()]
245262

@@ -251,11 +268,11 @@ def get_face_restorers(self):
251268

252269
def get_realesrgan_models(self):
253270
return [{"name":x.name,"path":x.data_path, "scale":x.scale} for x in get_realesrgan_models(None)]
254-
271+
255272
def get_promp_styles(self):
256273
styleList = []
257274
for k in shared.prompt_styles.styles:
258-
style = shared.prompt_styles.styles[k]
275+
style = shared.prompt_styles.styles[k]
259276
styleList.append({"name":style[0], "prompt": style[1], "negative_prompr": style[2]})
260277

261278
return styleList

modules/api/models.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import inspect
22
from pydantic import BaseModel, Field, create_model
3-
from typing import Any, Optional, Union
3+
from typing import Any, Optional
44
from typing_extensions import Literal
55
from inflection import underscore
66
from modules.processing import StableDiffusionProcessingTxt2Img, StableDiffusionProcessingImg2Img
77
from modules.shared import sd_upscalers, opts, parser
8-
from typing import List
8+
from typing import Dict, List
99

1010
API_NOT_ALLOWED = [
1111
"self",
@@ -185,22 +185,22 @@ class ProgressResponse(BaseModel):
185185
for key in _options:
186186
if(_options[key].dest != 'help'):
187187
flag = _options[key]
188-
_type = str
189-
if(_options[key].default != None): _type = type(_options[key].default)
188+
_type = str
189+
if _options[key].default is not None: _type = type(_options[key].default)
190190
flags.update({flag.dest: (_type,Field(default=flag.default, description=flag.help))})
191191

192192
FlagsModel = create_model("Flags", **flags)
193193

194194
class SamplerItem(BaseModel):
195195
name: str = Field(title="Name")
196-
aliases: list[str] = Field(title="Aliases")
197-
options: dict[str, str] = Field(title="Options")
196+
aliases: List[str] = Field(title="Aliases")
197+
options: Dict[str, str] = Field(title="Options")
198198

199199
class UpscalerItem(BaseModel):
200200
name: str = Field(title="Name")
201-
model_name: str | None = Field(title="Model Name")
202-
model_path: str | None = Field(title="Path")
203-
model_url: str | None = Field(title="URL")
201+
model_name: Optional[str] = Field(title="Model Name")
202+
model_path: Optional[str] = Field(title="Path")
203+
model_url: Optional[str] = Field(title="URL")
204204

205205
class SDModelItem(BaseModel):
206206
title: str = Field(title="Title")
@@ -211,23 +211,23 @@ class SDModelItem(BaseModel):
211211

212212
class HypernetworkItem(BaseModel):
213213
name: str = Field(title="Name")
214-
path: str | None = Field(title="Path")
214+
path: Optional[str] = Field(title="Path")
215215

216216
class FaceRestorerItem(BaseModel):
217217
name: str = Field(title="Name")
218-
cmd_dir: str | None = Field(title="Path")
218+
cmd_dir: Optional[str] = Field(title="Path")
219219

220220
class RealesrganItem(BaseModel):
221221
name: str = Field(title="Name")
222-
path: str | None = Field(title="Path")
223-
scale: int | None = Field(title="Scale")
222+
path: Optional[str] = Field(title="Path")
223+
scale: Optional[int] = Field(title="Scale")
224224

225225
class PromptStyleItem(BaseModel):
226226
name: str = Field(title="Name")
227-
prompt: str | None = Field(title="Prompt")
228-
negative_prompt: str | None = Field(title="Negative Prompt")
227+
prompt: Optional[str] = Field(title="Prompt")
228+
negative_prompt: Optional[str] = Field(title="Negative Prompt")
229229

230230
class ArtistItem(BaseModel):
231231
name: str = Field(title="Name")
232232
score: float = Field(title="Score")
233-
category: str = Field(title="Category")
233+
category: str = Field(title="Category")

modules/extensions.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,11 @@ def __init__(self, name, path, enabled=True):
3434
if repo is None or repo.bare:
3535
self.remote = None
3636
else:
37-
self.remote = next(repo.remote().urls, None)
38-
self.status = 'unknown'
37+
try:
38+
self.remote = next(repo.remote().urls, None)
39+
self.status = 'unknown'
40+
except Exception:
41+
self.remote = None
3942

4043
def list_files(self, subdir, extension):
4144
from modules import scripts

0 commit comments

Comments
 (0)