Skip to content

Commit 822210b

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents 116bcf7 + 89722fb commit 822210b

File tree

2 files changed

+74
-49
lines changed

2 files changed

+74
-49
lines changed

localizations/zh_TW.json

Lines changed: 33 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"Loading...": "載入中…",
88
"view": "檢視",
99
"api": "api",
10-
"•": "",
10+
"•": "",
1111
"built with gradio": "基於 Gradio 構建",
1212
"Stable Diffusion checkpoint": "Stable Diffusion 模型權重存檔點",
1313
"txt2img": "文生圖",
@@ -70,12 +70,12 @@
7070
"Variation strength": "差異強度",
7171
"Resize seed from width": "自寬度縮放隨機種子",
7272
"Resize seed from height": "自高度縮放隨機種子",
73-
"Open for Clip Aesthetic!": "打開美術風格 Clip!",
73+
"Open for Clip Aesthetic!": "打開以調整 Clip 的美術風格!",
7474
"▼": "",
7575
"Aesthetic weight": "美術風格權重",
7676
"Aesthetic steps": "美術風格疊代步數",
7777
"Aesthetic learning rate": "美術風格學習率",
78-
"Slerp interpolation": "Slerp 插值",
78+
"Slerp interpolation": "球面線性插值角度",
7979
"Aesthetic imgs embedding": "美術風格圖集 embedding",
8080
"None": "",
8181
"Aesthetic text for imgs": "該圖集的美術風格描述",
@@ -105,15 +105,15 @@
105105
"Prompt order": "提示詞順序",
106106
"Sampler": "採樣器",
107107
"Checkpoint name": "模型權重存檔點的名稱",
108-
"Hypernetwork": "超網路",
109-
"Hypernet str.": "超網路強度",
108+
"Hypernetwork": "超網路(Hypernetwork)",
109+
"Hypernet str.": "超網路(Hypernetwork)強度",
110110
"Sigma Churn": "Sigma Churn",
111111
"Sigma min": "最小 Sigma",
112112
"Sigma max": "最大 Sigma",
113113
"Sigma noise": "Sigma noise",
114114
"Eta": "Eta",
115115
"Clip skip": "Clip 跳過",
116-
"Denoising": "去噪",
116+
"Denoising": "重繪幅度",
117117
"Cond. Image Mask Weight": "圖像調節屏蔽度",
118118
"X values": "X軸數值",
119119
"Y type": "Y軸類型",
@@ -189,6 +189,7 @@
189189
"Tile overlap": "圖塊重疊的畫素",
190190
"Upscaler": "放大演算法",
191191
"Lanczos": "Lanczos",
192+
"Nearest": "最鄰近(整數縮放)",
192193
"LDSR": "LDSR",
193194
"BSRGAN 4x": "BSRGAN 4x",
194195
"ESRGAN_4x": "ESRGAN_4x",
@@ -230,15 +231,15 @@
230231
"for detailed explanation.": "以了解詳細說明",
231232
"Create embedding": "生成 embedding",
232233
"Create aesthetic images embedding": "生成美術風格圖集 embedding",
233-
"Create hypernetwork": "生成 hypernetwork",
234+
"Create hypernetwork": "生成超網路(Hypernetwork)",
234235
"Preprocess images": "圖像預處理",
235236
"Name": "名稱",
236237
"Initialization text": "初始化文字",
237238
"Number of vectors per token": "每個 token 的向量數",
238239
"Overwrite Old Embedding": "覆寫舊的 Embedding",
239240
"Modules": "模組",
240-
"Enter hypernetwork layer structure": "輸入 hypernetwork 層結構",
241-
"Select activation function of hypernetwork": "選擇 hypernetwork 的激活函數",
241+
"Enter hypernetwork layer structure": "輸入超網路(Hypernetwork)層結構",
242+
"Select activation function of hypernetwork": "選擇超網路(Hypernetwork)的激活函數",
242243
"linear": "linear",
243244
"relu": "relu",
244245
"leakyrelu": "leakyrelu",
@@ -276,7 +277,7 @@
276277
"XavierNormal": "Xavier 正態",
277278
"Add layer normalization": "加入層標準化",
278279
"Use dropout": "採用 dropout 防止過擬合",
279-
"Overwrite Old Hypernetwork": "覆寫舊的 Hypernetwork",
280+
"Overwrite Old Hypernetwork": "覆寫舊的超網路(Hypernetwork",
280281
"Source directory": "來源目錄",
281282
"Destination directory": "目標目錄",
282283
"Existing Caption txt Action": "對已有的TXT說明文字的行為",
@@ -298,11 +299,11 @@
298299
"Create debug image": "生成除錯圖片",
299300
"Preprocess": "預處理",
300301
"Train an embedding; must specify a directory with a set of 1:1 ratio images": "訓練 embedding; 必須指定一組具有 1:1 比例圖像的目錄",
301-
"Train an embedding or Hypernetwork; you must specify a directory with a set of 1:1 ratio images": "訓練 embedding 或者 hypernetwork; 必須指定一組具有 1:1 比例圖像的目錄",
302-
"[wiki]": "[wiki]",
302+
"Train an embedding or Hypernetwork; you must specify a directory with a set of 1:1 ratio images": "訓練 embedding 或者超網路(Hypernetwork); 必須指定一組具有 1:1 比例圖像的目錄",
303+
"[wiki]": "[wiki文件]",
303304
"Embedding": "Embedding",
304305
"Embedding Learning rate": "Embedding 學習率",
305-
"Hypernetwork Learning rate": "Hypernetwork 學習率",
306+
"Hypernetwork Learning rate": "超網路(Hypernetwork學習率",
306307
"Learning rate": "學習率",
307308
"Dataset directory": "資料集目錄",
308309
"Log directory": "日誌目錄",
@@ -312,7 +313,7 @@
312313
"Save a copy of embedding to log directory every N steps, 0 to disable": "每 N 步將 embedding 的副本儲存到日誌目錄,0 表示禁用",
313314
"Save images with embedding in PNG chunks": "儲存圖像,並在 PNG 圖片檔案中嵌入 embedding 檔案",
314315
"Read parameters (prompt, etc...) from txt2img tab when making previews": "進行預覽時,從文生圖頁籤中讀取參數(提示詞等)",
315-
"Train Hypernetwork": "訓練 Hypernetwork",
316+
"Train Hypernetwork": "訓練超網路(Hypernetwork",
316317
"Train Embedding": "訓練 Embedding",
317318
"Create an aesthetic embedding out of any number of images": "從任意數量的圖像中建立美術風格 embedding",
318319
"Create images embedding": "生成圖集 embedding",
@@ -418,7 +419,7 @@
418419
"Checkpoints to cache in RAM": "快取在內存(RAM)中的模型權重存檔點",
419420
"SD VAE": "模型的VAE",
420421
"auto": "自動",
421-
"Hypernetwork strength": "Hypernetwork 強度",
422+
"Hypernetwork strength": "超網路(Hypernetwork強度",
422423
"Inpainting conditioning mask strength": "局部重繪時圖像調節的蒙版屏蔽強度",
423424
"Apply color correction to img2img results to match original colors.": "對圖生圖結果套用顏色校正以匹配原始顏色",
424425
"With img2img, do exactly the amount of steps the slider specifies (normally you'd do less with less denoising).": "在進行圖生圖的時候,確切地執行滑塊指定的疊代步數(正常情況下更弱的重繪幅度需要更少的疊代步數)",
@@ -488,7 +489,17 @@
488489
"Extension": "擴充",
489490
"URL": "網址",
490491
"Update": "更新",
492+
"a1111-sd-webui-tagcomplete": "標記自動補全",
491493
"unknown": "未知",
494+
"deforum-for-automatic1111-webui": "Deforum",
495+
"sd-dynamic-prompting": "動態提示詞",
496+
"stable-diffusion-webui-aesthetic-gradients": "美術風格梯度",
497+
"stable-diffusion-webui-aesthetic-image-scorer": "美術風格評等",
498+
"stable-diffusion-webui-artists-to-study": "藝術家圖庫",
499+
"stable-diffusion-webui-dataset-tag-editor": "資料集標記編輯器",
500+
"stable-diffusion-webui-images-browser": "圖庫瀏覽器",
501+
"stable-diffusion-webui-inspiration": "靈感",
502+
"stable-diffusion-webui-wildcards": "萬用字元",
492503
"Load from:": "載入自",
493504
"Extension index URL": "擴充清單連結",
494505
"URL for extension's git repository": "擴充的 git 倉庫連結",
@@ -527,8 +538,8 @@
527538
"What to put inside the masked area before processing it with Stable Diffusion.": "在使用 Stable Diffusion 處理蒙版區域之前要在蒙版區域內放置什麼",
528539
"fill it with colors of the image": "用圖像的顏色(高強度模糊)填充它",
529540
"keep whatever was there originally": "保留原來的圖像,不進行預處理",
530-
"fill it with latent space noise": "用潛空間的噪聲填充它",
531-
"fill it with latent space zeroes": "用潛空間的零填充它",
541+
"fill it with latent space noise": "於潛空間填充噪聲",
542+
"fill it with latent space zeroes": "於潛空間填零",
532543
"Upscale masked region to target resolution, do inpainting, downscale back and paste into original image": "將蒙版區域(包括預留畫素長度的緩衝區域)放大到目標解析度,進行局部重繪。\n然後縮小並粘貼回原始圖像中",
533544
"Resize image to target resolution. Unless height and width match, you will get incorrect aspect ratio.": "將圖像大小調整為目標解析度。除非高度和寬度匹配,否則你將獲得不正確的縱橫比",
534545
"Resize the image so that entirety of target resolution is filled with the image. Crop parts that stick out.": "調整圖像大小,使整個目標解析度都被圖像填充。裁剪多出來的部分",
@@ -560,6 +571,8 @@
560571
"Select which Real-ESRGAN models to show in the web UI. (Requires restart)": "選擇哪些 Real-ESRGAN 模型顯示在網頁使用者介面。(需要重新啟動)",
561572
"Allowed categories for random artists selection when using the Roll button": "使用抽選藝術家按鈕時將會隨機的藝術家類別",
562573
"Append commas": "附加逗號",
574+
"latest": "最新",
575+
"behind": "落後",
563576
"Roll three": "抽三位出來",
564577
"Generate forever": "無限生成",
565578
"Cancel generate forever": "停止無限生成",
@@ -581,10 +594,9 @@
581594
"Start drawing": "開始繪製",
582595
"Description": "描述",
583596
"Action": "行動",
584-
"Aesthetic Gradients": "美術風格",
585-
"aesthetic-gradients": "美術風格",
586-
"stable-diffusion-webui-wildcards": "萬用字元",
587-
"Dynamic Prompts": "動態提示",
597+
"Aesthetic Gradients": "美術風格梯度",
598+
"aesthetic-gradients": "美術風格梯度",
599+
"Dynamic Prompts": "動態提示詞",
588600
"images-browser": "圖庫瀏覽器",
589601
"Inspiration": "靈感",
590602
"Deforum": "Deforum",

modules/script_callbacks.py

Lines changed: 41 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -46,33 +46,31 @@ def __init__(self, x, image_cond, sigma, sampling_step, total_sampling_steps):
4646

4747

4848
ScriptCallback = namedtuple("ScriptCallback", ["script", "callback"])
49-
callbacks_app_started = []
50-
callbacks_model_loaded = []
51-
callbacks_ui_tabs = []
52-
callbacks_ui_settings = []
53-
callbacks_before_image_saved = []
54-
callbacks_image_saved = []
55-
callbacks_cfg_denoiser = []
49+
callback_map = dict(
50+
callbacks_app_started=[],
51+
callbacks_model_loaded=[],
52+
callbacks_ui_tabs=[],
53+
callbacks_ui_settings=[],
54+
callbacks_before_image_saved=[],
55+
callbacks_image_saved=[],
56+
callbacks_cfg_denoiser=[]
57+
)
5658

5759

5860
def clear_callbacks():
59-
callbacks_model_loaded.clear()
60-
callbacks_ui_tabs.clear()
61-
callbacks_ui_settings.clear()
62-
callbacks_before_image_saved.clear()
63-
callbacks_image_saved.clear()
64-
callbacks_cfg_denoiser.clear()
61+
for callback_list in callback_map.values():
62+
callback_list.clear()
6563

6664
def app_started_callback(demo: Optional[Blocks], app: FastAPI):
67-
for c in callbacks_app_started:
65+
for c in callback_map['callbacks_app_started']:
6866
try:
6967
c.callback(demo, app)
7068
except Exception:
7169
report_exception(c, 'app_started_callback')
7270

7371

7472
def model_loaded_callback(sd_model):
75-
for c in callbacks_model_loaded:
73+
for c in callback_map['callbacks_model_loaded']:
7674
try:
7775
c.callback(sd_model)
7876
except Exception:
@@ -82,7 +80,7 @@ def model_loaded_callback(sd_model):
8280
def ui_tabs_callback():
8381
res = []
8482

85-
for c in callbacks_ui_tabs:
83+
for c in callback_map['callbacks_ui_tabs']:
8684
try:
8785
res += c.callback() or []
8886
except Exception:
@@ -92,31 +90,31 @@ def ui_tabs_callback():
9290

9391

9492
def ui_settings_callback():
95-
for c in callbacks_ui_settings:
93+
for c in callback_map['callbacks_ui_settings']:
9694
try:
9795
c.callback()
9896
except Exception:
9997
report_exception(c, 'ui_settings_callback')
10098

10199

102100
def before_image_saved_callback(params: ImageSaveParams):
103-
for c in callbacks_before_image_saved:
101+
for c in callback_map['callbacks_before_image_saved']:
104102
try:
105103
c.callback(params)
106104
except Exception:
107105
report_exception(c, 'before_image_saved_callback')
108106

109107

110108
def image_saved_callback(params: ImageSaveParams):
111-
for c in callbacks_image_saved:
109+
for c in callback_map['callbacks_image_saved']:
112110
try:
113111
c.callback(params)
114112
except Exception:
115113
report_exception(c, 'image_saved_callback')
116114

117115

118116
def cfg_denoiser_callback(params: CFGDenoiserParams):
119-
for c in callbacks_cfg_denoiser:
117+
for c in callback_map['callbacks_cfg_denoiser']:
120118
try:
121119
c.callback(params)
122120
except Exception:
@@ -129,17 +127,33 @@ def add_callback(callbacks, fun):
129127

130128
callbacks.append(ScriptCallback(filename, fun))
131129

130+
131+
def remove_current_script_callbacks():
132+
stack = [x for x in inspect.stack() if x.filename != __file__]
133+
filename = stack[0].filename if len(stack) > 0 else 'unknown file'
134+
if filename == 'unknown file':
135+
return
136+
for callback_list in callback_map.values():
137+
for callback_to_remove in [cb for cb in callback_list if cb.script == filename]:
138+
callback_list.remove(callback_to_remove)
139+
140+
141+
def remove_callbacks_for_function(callback_func):
142+
for callback_list in callback_map.values():
143+
for callback_to_remove in [cb for cb in callback_list if cb.callback == callback_func]:
144+
callback_list.remove(callback_to_remove)
145+
132146

133147
def on_app_started(callback):
134148
"""register a function to be called when the webui started, the gradio `Block` component and
135149
fastapi `FastAPI` object are passed as the arguments"""
136-
add_callback(callbacks_app_started, callback)
150+
add_callback(callback_map['callbacks_app_started'], callback)
137151

138152

139153
def on_model_loaded(callback):
140154
"""register a function to be called when the stable diffusion model is created; the model is
141155
passed as an argument"""
142-
add_callback(callbacks_model_loaded, callback)
156+
add_callback(callback_map['callbacks_model_loaded'], callback)
143157

144158

145159
def on_ui_tabs(callback):
@@ -152,35 +166,34 @@ def on_ui_tabs(callback):
152166
title is tab text displayed to user in the UI
153167
elem_id is HTML id for the tab
154168
"""
155-
add_callback(callbacks_ui_tabs, callback)
169+
add_callback(callback_map['callbacks_ui_tabs'], callback)
156170

157171

158172
def on_ui_settings(callback):
159173
"""register a function to be called before UI settings are populated; add your settings
160174
by using shared.opts.add_option(shared.OptionInfo(...)) """
161-
add_callback(callbacks_ui_settings, callback)
175+
add_callback(callback_map['callbacks_ui_settings'], callback)
162176

163177

164178
def on_before_image_saved(callback):
165179
"""register a function to be called before an image is saved to a file.
166180
The callback is called with one argument:
167181
- params: ImageSaveParams - parameters the image is to be saved with. You can change fields in this object.
168182
"""
169-
add_callback(callbacks_before_image_saved, callback)
183+
add_callback(callback_map['callbacks_before_image_saved'], callback)
170184

171185

172186
def on_image_saved(callback):
173187
"""register a function to be called after an image is saved to a file.
174188
The callback is called with one argument:
175189
- params: ImageSaveParams - parameters the image was saved with. Changing fields in this object does nothing.
176190
"""
177-
add_callback(callbacks_image_saved, callback)
191+
add_callback(callback_map['callbacks_image_saved'], callback)
178192

179193

180194
def on_cfg_denoiser(callback):
181195
"""register a function to be called in the kdiffussion cfg_denoiser method after building the inner model inputs.
182196
The callback is called with one argument:
183197
- params: CFGDenoiserParams - parameters to be passed to the inner model and sampling state details.
184198
"""
185-
add_callback(callbacks_cfg_denoiser, callback)
186-
199+
add_callback(callback_map['callbacks_cfg_denoiser'], callback)

0 commit comments

Comments
 (0)