🚀 simpletuner-lora
これはblack-forest-labs/FLUX.1-schnellをベースにしたLyCORISアダプターです。
トレーニング中に使用された主な検証プロンプトは以下の通りです。
A photo-realistic image of woozi_seventeen
✨ 主な機能
検証設定
- CFG:
3.0
- CFG Rescale:
0.0
- ステップ数:
4
- サンプラー:
FlowMatchEulerDiscreteScheduler
- シード:
42
- 解像度:
1024x1024
- スキップレイヤーガイダンス:
注意: 検証設定はトレーニング設定と必ずしも同じではありません。
以下のギャラリーでいくつかのサンプル画像を見ることができます。
テキストエンコーダはトレーニングされていません。推論にはベースモデルのテキストエンコーダを再利用できます。
トレーニング設定
- トレーニングエポック数: 63
- トレーニングステップ数: 10001
- 学習率: 0.0001
- 学習率スケジュール: 多項式
- ウォームアップステップ数: 100
- 最大勾配値: 2.0
- 有効バッチサイズ: 1
- マイクロバッチサイズ: 1
- 勾配累積ステップ数: 1
- GPU数: 1
- 勾配チェックポイント: True
- 予測タイプ: flow-matching (追加パラメータ=['flux_fast_schedule', 'shift=3', 'flux_guidance_mode=constant', 'flux_guidance_value=1.0', 'flow_matching_loss=compatible'])
- オプティマイザ: adamw_bf16
- 学習可能パラメータ精度: Pure BF16
- ベースモデル精度:
no_change
- キャプションドロップアウト確率: 10.0%
LyCORIS設定
{
"algo": "lokr",
"multiplier": 1.0,
"full_matrix": true,
"linear_alpha": 1,
"factor": 16,
"apply_preset": {
"target_module": [
"Attention",
"FeedForward"
],
"module_algo_map": {
"Attention": {
"factor": 16
},
"FeedForward": {
"factor": 8
}
}
}
}
データセット
something-special-to-remember-by
- 繰り返し数: 1
- 画像総数: 79
- アスペクトバケット総数: 9
- 解像度: 512 px
- クロップ: False
- クロップスタイル: None
- クロップアスペクト: None
- 正則化データとして使用: No
💻 使用例
基本的な使用法
import torch
from diffusers import DiffusionPipeline
from lycoris import create_lycoris_from_weights
def download_adapter(repo_id: str):
import os
from huggingface_hub import hf_hub_download
adapter_filename = "pytorch_lora_weights.safetensors"
cache_dir = os.environ.get('HF_PATH', os.path.expanduser('~/.cache/huggingface/hub/models'))
cleaned_adapter_path = repo_id.replace("/", "_").replace("\\", "_").replace(":", "_")
path_to_adapter = os.path.join(cache_dir, cleaned_adapter_path)
path_to_adapter_file = os.path.join(path_to_adapter, adapter_filename)
os.makedirs(path_to_adapter, exist_ok=True)
hf_hub_download(
repo_id=repo_id, filename=adapter_filename, local_dir=path_to_adapter
)
return path_to_adapter_file
model_id = 'black-forest-labs/FLUX.1-schnell'
adapter_repo_id = 'MyKPopWishList/simpletuner-lora'
adapter_filename = 'pytorch_lora_weights.safetensors'
adapter_file_path = download_adapter(repo_id=adapter_repo_id)
pipeline = DiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.bfloat16)
lora_scale = 1.0
wrapper, _ = create_lycoris_from_weights(lora_scale, adapter_file_path, pipeline.transformer)
wrapper.merge_to()
prompt = "A photo-realistic image of woozi_seventeen"
pipeline.to('cuda' if torch.cuda.is_available() else 'mps' if torch.backends.mps.is_available() else 'cpu')
model_output = pipeline(
prompt=prompt,
num_inference_steps=4,
generator=torch.Generator(device='cuda' if torch.cuda.is_available() else 'mps' if torch.backends.mps.is_available() else 'cpu').manual_seed(42),
width=1024,
height=1024,
guidance_scale=3.0,
).images[0]
model_output.save("output.png", format="PNG")
📄 ライセンス
other