Skip to content

Instantly share code, notes, and snippets.

@hinablue
hinablue / modify_zlora.py
Last active December 26, 2025 16:41
Modify AI-Toolkit Z Image Turbo Lora
import argparse
import re
import torch
from safetensors.torch import load_file, save_file
import sys
import os
# ============================================================================
# 輔助函數:鍵和層處理
@hinablue
hinablue / SD3.5_SLG_workflow.json
Last active July 22, 2025 03:41
SD3.5Large and Medium upscaling and SLG workflow
{
"id": "25ddb7ca-28dd-436d-989c-dd4a5b171975",
"revision": 0,
"last_node_id": 430,
"last_link_id": 1471,
"nodes": [
{
"id": 68,
"type": "ConditioningSetTimestepRange",
"pos": [
@hinablue
hinablue / README.md
Last active December 26, 2025 09:13
Flux.1 Dev Lora training by Kohya with multiple resolutions

多解析度訓練

!!以上訓練參數會使用 16GB+ 以上的 VRAM,請自行斟酌使用!!


在 Kohya 使用多解析度訓練,在 datasets 的配置上可以採用以下規則:

解析度 說明
{
"LoRA_type": "LyCORIS/LoCon",
"LyCORIS_preset": "full",
"adaptive_noise_scale": 0,
"additional_parameters": "--log_prefix=sdxl_ --enable_wildcard --keep_tokens_separator=\"___\"",
"async_upload": false,
"block_alphas": "",
"block_dims": "",
"block_lr_zero_threshold": "",
"bucket_no_upscale": true,
@hinablue
hinablue / gpt4o_caption.py
Last active June 4, 2024 09:46
Caption image with GPT-4o
import os
import sys
import shutil
import argparse
import base64
import requests
import json
from PIL import Image
from io import BytesIO
from tqdm import tqdm
{
"LoRA_type": "LyCORIS/LoCon",
"LyCORIS_preset": "full",
"adaptive_noise_scale": 0,
"additional_parameters": "--log_prefix=xl-locon --enable_wildcard",
"async_upload": false,
"block_alphas": "",
"block_dims": "",
"block_lr_zero_threshold": "",
"bucket_no_upscale": true,
import os
import sys
from PIL import Image
import cv2
import numpy as np
import math
import shutil
from typing import NamedTuple, Tuple
import argparse
from prettytable import PrettyTable
@hinablue
hinablue / Dockerfile
Created April 19, 2024 12:36
Forge Docker
FROM nvidia/cuda:12.3.2-runtime-ubuntu22.04
WORKDIR /app
RUN apt update && apt upgrade -y
RUN apt install -y wget git python3 python3-dev python3-pip python3-venv libgl1 libglib2.0-0 apt-transport-https libgoogle-perftools-dev libgoogle-perftools4 libtcmalloc-minimal4 bc jq
COPY entrypoint.sh /app/entrypoint.sh
RUN chmod +x /app/entrypoint.sh
RUN useradd -m webui
RUN chown -R webui:webui /app \

Keybase proof

I hereby claim:

  • I am hinablue on github.
  • I am hinablue (https://keybase.io/hinablue) on keybase.
  • I have a public key ASBvGFjdRoKkQkqJ1WzR56ZfP2sd1uwCq6aM2NVXLgcxoQo

To claim this, I am signing this object:

@hinablue
hinablue / Dockerfile
Last active July 2, 2019 12:30
NginxLua
FROM openresty/openresty:alpine
MAINTAINER Hina Chen <hinablue@gmail.com>
WORKDIR /build
# Install Nginx
RUN apk --update add \
nginx \
nginx-mod-http-lua \
nginx-mod-http-lua-upstream