Instructions to use timduck8/mm3d with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use timduck8/mm3d with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("timduck8/mm3d", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Draw Things
- DiffusionBee
refactor: 移除未使用的转换脚本和依赖文件
Browse files- convert_to_diffusers.py +0 -69
- requirements.txt +0 -7
convert_to_diffusers.py
DELETED
|
@@ -1,69 +0,0 @@
|
|
| 1 |
-
"""
|
| 2 |
-
将 .safetensors 文件转换为 Diffusers 格式的脚本
|
| 3 |
-
用于 fal.ai 等需要完整 Diffusers 格式的平台
|
| 4 |
-
"""
|
| 5 |
-
|
| 6 |
-
from diffusers import StableDiffusionXLPipeline
|
| 7 |
-
import torch
|
| 8 |
-
import os
|
| 9 |
-
|
| 10 |
-
def convert_to_diffusers(
|
| 11 |
-
input_path: str,
|
| 12 |
-
output_dir: str,
|
| 13 |
-
torch_dtype=torch.float16
|
| 14 |
-
):
|
| 15 |
-
"""
|
| 16 |
-
转换 .safetensors 文件为 Diffusers 格式
|
| 17 |
-
|
| 18 |
-
Args:
|
| 19 |
-
input_path: 输入的 .safetensors 文件路径
|
| 20 |
-
output_dir: 输出的 Diffusers 格式目录
|
| 21 |
-
torch_dtype: 模型精度,默认 float16
|
| 22 |
-
"""
|
| 23 |
-
|
| 24 |
-
print(f"开始转换: {input_path}")
|
| 25 |
-
print(f"目标目录: {output_dir}")
|
| 26 |
-
|
| 27 |
-
# 检查输入文件是否存在
|
| 28 |
-
if not os.path.exists(input_path):
|
| 29 |
-
raise FileNotFoundError(f"找不到文件: {input_path}")
|
| 30 |
-
|
| 31 |
-
# 加载单个文件
|
| 32 |
-
print("\n步骤 1/2: 加载 .safetensors 文件...")
|
| 33 |
-
pipe = StableDiffusionXLPipeline.from_single_file(
|
| 34 |
-
input_path,
|
| 35 |
-
torch_dtype=torch_dtype,
|
| 36 |
-
use_safetensors=True
|
| 37 |
-
)
|
| 38 |
-
|
| 39 |
-
# 保存为 Diffusers 格式
|
| 40 |
-
print("\n步骤 2/2: 保存为 Diffusers 格式...")
|
| 41 |
-
pipe.save_pretrained(
|
| 42 |
-
output_dir,
|
| 43 |
-
safe_serialization=True
|
| 44 |
-
)
|
| 45 |
-
|
| 46 |
-
print("\n✓ 转换完成!")
|
| 47 |
-
print(f"\n生成的目录结构位于: {output_dir}")
|
| 48 |
-
print("\n包含的文件:")
|
| 49 |
-
print(" ├── model_index.json")
|
| 50 |
-
print(" ├── scheduler/")
|
| 51 |
-
print(" ├── text_encoder/")
|
| 52 |
-
print(" ├── text_encoder_2/")
|
| 53 |
-
print(" ├── tokenizer/")
|
| 54 |
-
print(" ├── tokenizer_2/")
|
| 55 |
-
print(" ├── unet/")
|
| 56 |
-
print(" └── vae/")
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
if __name__ == "__main__":
|
| 60 |
-
# 配置参数
|
| 61 |
-
INPUT_FILE = "./miaomiao3DHarem_lh3d10.safetensors"
|
| 62 |
-
OUTPUT_DIR = "./miaomiao3DHarem_lh3d10-diffusers"
|
| 63 |
-
|
| 64 |
-
# 执行转换
|
| 65 |
-
convert_to_diffusers(
|
| 66 |
-
input_path=INPUT_FILE,
|
| 67 |
-
output_dir=OUTPUT_DIR,
|
| 68 |
-
torch_dtype=torch.float16
|
| 69 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
requirements.txt
DELETED
|
@@ -1,7 +0,0 @@
|
|
| 1 |
-
numpy<2.0.0,>=1.24.0
|
| 2 |
-
torch==2.4.0
|
| 3 |
-
torchvision==0.19.0
|
| 4 |
-
diffusers>=0.21.0
|
| 5 |
-
transformers>=4.30.0
|
| 6 |
-
accelerate>=0.20.0
|
| 7 |
-
safetensors>=0.3.1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|