Skip to content

Instantly share code, notes, and snippets.

View tori29umai0123's full-sized avatar
🏠

tori29umai tori29umai0123

🏠
View GitHub Profile
import tempfile
import gradio as gr
import numpy as np
import torch
from PIL import Image
import trimesh
from huggingface_hub import hf_hub_download
from depth_anything_v2.dpt import DepthAnythingV2
from pygltflib import GLTF2, Node, Camera, Perspective, Scene
# Copyright 2024-2025 The Alibaba Wan Team Authors. All rights reserved.
from typing import Optional
import torch
try:
import flash_attn_interface
FLASH_ATTN_3_AVAILABLE = True
except ModuleNotFoundError:
FLASH_ATTN_3_AVAILABLE = False
import argparse
from datetime import datetime
import gc
import random
import os
import re
import time
import math
import copy
from types import ModuleType, SimpleNamespace
登場人物
勇者(男女選択可能)
数々の試練を乗り越え、魔王を討伐する勇者として認められた。
お人よし故に周囲に流されがちだが、いざという時は強い意志を見せる。
かつての幼馴染を取り戻すのが目的。
魔王(男女選択可能)
世界を破壊と混沌の闇に陥れようと目論む魔王。
勇者の幼馴染の体を奪い復活した。
import os
import sys
import numpy as np
import torch
from PIL import Image
sys.path.append(os.getcwd()) # 現在のディレクトリをシステムパスに追加
from tha3.poser.modes.load_poser import load_poser
from tha3.util import rgba_to_numpy_image, grid_change_to_numpy_image, rgb_to_numpy_image, extract_pytorch_image_from_PIL_image
import random
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from typing import Literal
# RATING、ASPECT_RATIO、LENGTH の選択肢を指定
RATING = Literal[
"<|rating:general|>",
"<|rating:sensitive|>",
pretrained_model_name_or_path = "models/animagine-xl-3.1.safetensors"
train_data_dir = "train_data"
output_dir = "models/LoRA"
max_train_steps = 500
network_module = "networks.lora"
xformers = true
gradient_checkpointing = true
persistent_data_loader_workers = false
max_data_loader_n_workers = 0
enable_bucket = true
{
"book": "Test",
"pages": [
{
"page": 0,
"width": 1654,
"height": 1170,
"texts": [
{
"text": "こんにちは。いい天気ですね",
# 学習には https://gist.github.com/tori29umai0123/fc51ea86aedc1b1e394b12829d1c95e5 のような形式のデータセットを利用する
# Manga109-sのアノテーションデータ(http://www.manga109.org/ja/annotations.html)を元に作成
import os
import glob
import json
import argparse
import torch
from torch.utils.data import Dataset, DataLoader
import torch.nn as nn
@tori29umai0123
tori29umai0123 / LibreSketch.py
Created September 26, 2024 06:35
LibreSketch.py
import configparser
import copy
import math
import os
import sys
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
from scipy.interpolate import PchipInterpolator
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas