force to use optimized sha256, update document for updating SD webui's version
parent
963cf63750
commit
fc0f1dfaea
|
|
@ -19,6 +19,12 @@ Stable Diffusion Webui 扩展Civitai助手,用于更轻松的管理和使用Ci
|
|||
|
||||
|
||||
# 使用方法
|
||||
## 更新你的SD webui
|
||||
本扩展需要取到 Extra Network的卡片列表id。**这个是从2023-02-06,才添加到SD webui里面的。**
|
||||
|
||||
所以,如果你用的版本比这个早,你就需要先更新你的SD Webui!
|
||||
|
||||
|
||||
## 扫描模型
|
||||
前往扩展页面"Civitai Helper",有个按钮叫:"Scan Model"
|
||||
|
||||
|
|
|
|||
|
|
@ -26,6 +26,11 @@ Then reload UI with "Reload UI" Button in Setting tab.
|
|||
Done.
|
||||
|
||||
# How to Use
|
||||
## Update Your SD Webui
|
||||
This extension need to get extra network's cards id. **Which is added to SD webui since 2023-02-06.**
|
||||
|
||||
So, if you are using a version older than this, you need to update your SD Webui!
|
||||
|
||||
## Scanning Models
|
||||
Go to extension tab "Civitai Helper". There is a button called "Scan model".
|
||||
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ def on_ui_tabs():
|
|||
with gr.Column():
|
||||
gr.Markdown("### Scan Models for Civitai")
|
||||
with gr.Row():
|
||||
low_memory_sha_ckb = gr.Checkbox(label="Memory Optimized SHA256", value=low_memory_sha, elem_id="ch_low_memory_sha_ckb")
|
||||
low_memory_sha_ckb = gr.Checkbox(label="Memory Optimized SHA256", value=low_memory_sha, visible=False, elem_id="ch_low_memory_sha_ckb")
|
||||
max_size_preview_ckb = gr.Checkbox(label="Download Max Size Preview", value=max_size_preview, elem_id="ch_max_size_preview_ckb")
|
||||
skip_nsfw_preview_ckb = gr.Checkbox(label="SKip NSFW Preview images", value=skip_nsfw_preview, elem_id="ch_skip_nsfw_preview_ckb")
|
||||
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ def scan_model(low_memory_sha, max_size_preview, skip_nsfw_preview):
|
|||
info_file = base + civitai.suffix + model.info_ext
|
||||
# check info file
|
||||
if not os.path.isfile(info_file):
|
||||
util.printD("Creating model info for: " + filename)
|
||||
# get model's sha256
|
||||
hash = util.gen_file_sha256(item, low_memory_sha)
|
||||
|
||||
|
|
|
|||
|
|
@ -12,12 +12,17 @@ def gen_file_sha256(filname, is_low_memory=True):
|
|||
printD("Calculate SHA256")
|
||||
hash_sha256 = hashlib.sha256()
|
||||
with open(filname, "rb") as f:
|
||||
if is_low_memory:
|
||||
printD("Using Memory Optimized SHA256")
|
||||
for chunk in iter(lambda: f.read(4096), b""):
|
||||
hash_sha256.update(chunk)
|
||||
else:
|
||||
hash_sha256.update(f.read())
|
||||
# force to use Memory Optimized SHA256
|
||||
# In case people don't understand this and uncheck it then stuck their system
|
||||
printD("Using Memory Optimized SHA256")
|
||||
for chunk in iter(lambda: f.read(4096), b""):
|
||||
hash_sha256.update(chunk)
|
||||
# if is_low_memory:
|
||||
# printD("Using Memory Optimized SHA256")
|
||||
# for chunk in iter(lambda: f.read(4096), b""):
|
||||
# hash_sha256.update(chunk)
|
||||
# else:
|
||||
# hash_sha256.update(f.read())
|
||||
|
||||
|
||||
hash_value = hash_sha256.hexdigest()
|
||||
|
|
|
|||
Loading…
Reference in New Issue