Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 263c1a9cc4 | |||
| cffca352f9 | |||
| 29e820ce55 | |||
| 41eb07dbff | |||
| a5d1015ef9 | |||
| 9e4b0888b0 | |||
| a0cb3b6de3 | |||
| 8339047e58 | |||
| a5e99f37f9 | |||
| 335e37d4f0 | |||
| 487cf4d578 | |||
| 126cc2cbe8 | |||
| 19b36b07fb | |||
| 12760301c6 |
163
README.md
@ -1,7 +1,4 @@
|
||||
---
|
||||
base_model: AI-ModelScope/FLUX.1-dev
|
||||
cover_images:
|
||||
- _cover_images_/cover.png
|
||||
frameworks:
|
||||
- Pytorch
|
||||
license: Apache License 2.0
|
||||
@ -12,47 +9,133 @@ tasks:
|
||||
- text-to-image-synthesis
|
||||
vision_foundation: FLUX_1
|
||||
|
||||
#model-type:
|
||||
##如 gpt、phi、llama、chatglm、baichuan 等
|
||||
#- gpt
|
||||
|
||||
#domain:
|
||||
##如 nlp、cv、audio、multi-modal
|
||||
#- nlp
|
||||
|
||||
#language:
|
||||
##语言代码列表 https://help.aliyun.com/document_detail/215387.html?spm=a2c4g.11186623.0.0.9f8d7467kni6Aa
|
||||
#- cn
|
||||
|
||||
#metrics:
|
||||
##如 CIDEr、Blue、ROUGE 等
|
||||
#- CIDEr
|
||||
|
||||
#tags:
|
||||
##各种自定义,包括 pretrained、fine-tuned、instruction-tuned、RL-tuned 等训练方法和其他
|
||||
#- pretrained
|
||||
|
||||
#tools:
|
||||
##如 vllm、fastchat、llamacpp、AdaSeq 等
|
||||
#- vllm
|
||||
base_model:
|
||||
- black-forest-labs/FLUX.1-dev
|
||||
---
|
||||
### 当前模型的贡献者未提供更加详细的模型介绍。模型文件和权重,可浏览“模型文件”页面获取。
|
||||
#### 您可以通过如下git clone命令,或者ModelScope SDK来下载模型
|
||||
|
||||
SDK下载
|
||||
```bash
|
||||
#安装ModelScope
|
||||
pip install modelscope
|
||||
麦橘超然 MajicFlus 是一款基于 [flux.dev](https://www.modelscope.cn/models/black-forest-labs/FLUX.1-dev) 微调融合的模型,专注于高质量人像生成,尤其擅长表现 亚洲女性 的细腻与美感。模型以 **唯美、写实、易用** 为核心特色,能够通过简单的提示词生成优质效果,同时对复杂提示词也有出色的响应能力。
|
||||
|
||||
## 模型特点
|
||||
- 卓越的人像生成能力: 优化了在不同光影条件下的表现,确保人像在各种构图中的 面部细节 和 肢体完整性。
|
||||
|
||||
- 广泛的适用性: 除了人像生成外,模型在生成 非人生物 和 场景 时也有显著改进,适应更多创作需求。
|
||||
|
||||
- 简单易用: 用户无需复杂的提示词即可生成高质量作品,同时支持更长提示词的精细控制。
|
||||
|
||||
## 社区适配
|
||||
MajicFlus 模型在发布的同时,多位社区成员基于模型制作的 LoRA 也将一同发布,进一步扩展了模型的功能与表现力。这些 LoRA 为用户提供了更多样化的创作可能性,使模型能够适应更多特定场景和风格需求。
|
||||
|
||||
## 弱点
|
||||
|
||||
- MajicFlus 并非为生成 NSFW 内容而设计。然而,如果有需要,可以使用相关 LoRA 来实现此类目的。
|
||||
|
||||
- MajicFlus 的存在是为了解决国际社区中模型缺乏亚洲代表性的问题。如果您希望生成非亚洲种族的图像,请考虑使用其他高质量模型。
|
||||
|
||||
- 由于该模型是个微调融合模型,对社区大部分的lora都是不完美兼容的,需要降低权重至0.5以下。推荐使用带有majicFlus标志的矩阵模型,搜索关键字majic并筛选f1模型就可以看到全部,现在已有超过50款风格各异的优质模型。
|
||||
|
||||
## 参数推荐 Parameter
|
||||
- Steps: 20~30
|
||||
- Distilled CFG Scale: 3.5
|
||||
- CFG : 1
|
||||
- Diffusion in Low Bits: float8-e4m3fn
|
||||
- Sampling: Euler + simple/beta (for general),DPM2M + SGM uniform (for skin texture),DEIS + DDIM uniform (for casual realistic look)
|
||||
- Vae: flux vae
|
||||
- Clip: clip_l.safetensors and t5xxl_fp8_e4m3fn.safetensors
|
||||
|
||||
## 生图
|
||||
|
||||
本模型可通过[AIGC专区生图](https://www.modelscope.cn/aigc/imageGeneration?tab=advanced&versionId=14497&modelType=Checkpoint&sdVersion=FLUX_1&modelUrl=modelscope%3A%2F%2FMAILAND%2Fmajicflus_v1%3Frevision%3Dv1.0)直接在线使用。也通过ModelScope API-Inference使用(见本页面右侧)。
|
||||
|
||||
如果要下载模型到本地进行推理生图,需要结合原始FLUX模型的vae等模块,可以使用DiffSynth-Studio封装好的生图pipeline。
|
||||
|
||||
### 安装DiffSynth
|
||||
```
|
||||
pip install diffsynth -U
|
||||
```
|
||||
|
||||
### 推理生图
|
||||
|
||||
#### 量化推理(需要至少 14G 显存)
|
||||
推荐方式,能在较小显存下,实现无损生图。需要较大的内存来支持模型不同模块的逐个加载。
|
||||
|
||||
```python
|
||||
#SDK模型下载
|
||||
import torch
|
||||
from modelscope import snapshot_download
|
||||
model_dir = snapshot_download('merjic/majicflus_v1')
|
||||
```
|
||||
Git下载
|
||||
```
|
||||
#Git模型下载
|
||||
git clone https://www.modelscope.cn/merjic/majicflus_v1.git
|
||||
from diffsynth import ModelManager, FluxImagePipeline
|
||||
|
||||
# 下载模型
|
||||
snapshot_download(
|
||||
model_id="MAILAND/majicflus_v1",
|
||||
allow_file_pattern="majicflus_v134.safetensors",
|
||||
cache_dir="models"
|
||||
)
|
||||
snapshot_download(
|
||||
model_id="black-forest-labs/FLUX.1-dev",
|
||||
allow_file_pattern=["ae.safetensors", "text_encoder/model.safetensors", "text_encoder_2/*"],
|
||||
cache_dir="models"
|
||||
)
|
||||
|
||||
# 设置推理计算精度为 bfloat16
|
||||
model_manager = ModelManager(torch_dtype=torch.bfloat16)
|
||||
# 以 float8 精度加载 DiT 部分
|
||||
model_manager.load_models(
|
||||
["models/MAILAND/majicflus_v1/majicflus_v134.safetensors"],
|
||||
torch_dtype=torch.float8_e4m3fn,
|
||||
device="cpu"
|
||||
)
|
||||
# 以 bfloat16 精度加载两个 Text Encoder 和 VAE
|
||||
model_manager.load_models(
|
||||
[
|
||||
"models/black-forest-labs/FLUX.1-dev/text_encoder/model.safetensors",
|
||||
"models/black-forest-labs/FLUX.1-dev/text_encoder_2",
|
||||
"models/black-forest-labs/FLUX.1-dev/ae.safetensors",
|
||||
],
|
||||
torch_dtype=torch.bfloat16,
|
||||
device="cpu"
|
||||
)
|
||||
# 开启量化与显存管理
|
||||
pipe = FluxImagePipeline.from_model_manager(model_manager, device="cuda")
|
||||
pipe.enable_cpu_offload()
|
||||
pipe.dit.quantize()
|
||||
|
||||
# 生图!
|
||||
image = pipe(prompt="a beautiful girl", seed=0)
|
||||
image.save("image.jpg")
|
||||
```
|
||||
|
||||
<p style="color: lightgrey;">如果您是本模型的贡献者,我们邀请您根据<a href="https://modelscope.cn/docs/ModelScope%E6%A8%A1%E5%9E%8B%E6%8E%A5%E5%85%A5%E6%B5%81%E7%A8%8B%E6%A6%82%E8%A7%88" style="color: lightgrey; text-decoration: underline;">模型贡献文档</a>,及时完善模型卡片内容。</p>
|
||||
#### 原生精度推理(需要至少 40G 显存)
|
||||
|
||||
```python
|
||||
import torch
|
||||
from modelscope import snapshot_download
|
||||
from diffsynth import ModelManager, FluxImagePipeline
|
||||
|
||||
# 下载模型
|
||||
snapshot_download(
|
||||
model_id="MAILAND/majicflus_v1",
|
||||
allow_file_pattern="majicflus_v134.safetensors",
|
||||
cache_dir="models"
|
||||
)
|
||||
snapshot_download(
|
||||
model_id="black-forest-labs/FLUX.1-dev",
|
||||
allow_file_pattern=["ae.safetensors", "text_encoder/model.safetensors", "text_encoder_2/*"],
|
||||
cache_dir="models"
|
||||
)
|
||||
|
||||
# 加载模型
|
||||
model_manager = ModelManager(
|
||||
torch_dtype=torch.bfloat16,
|
||||
device="cuda",
|
||||
file_path_list=[
|
||||
"models/black-forest-labs/FLUX.1-dev/text_encoder/model.safetensors",
|
||||
"models/black-forest-labs/FLUX.1-dev/text_encoder_2",
|
||||
"models/black-forest-labs/FLUX.1-dev/ae.safetensors",
|
||||
"models/MAILAND/majicflus_v1/majicflus_v134.safetensors",
|
||||
]
|
||||
)
|
||||
pipe = FluxImagePipeline.from_model_manager(model_manager, device="cuda")
|
||||
|
||||
# 生图!
|
||||
image = pipe(prompt="a beautiful girl", seed=0)
|
||||
image.save("image.jpg")
|
||||
```
|
||||
|
||||
|
Before Width: | Height: | Size: 15 MiB |
BIN
_cover_images_/cover.png
Normal file
|
After Width: | Height: | Size: 1.1 MiB |
BIN
_cover_images_/cover2.png
Normal file
|
After Width: | Height: | Size: 1.2 MiB |
BIN
_cover_images_/cover3.webp
Normal file
|
After Width: | Height: | Size: 26 KiB |
BIN
_cover_images_/cover4.webp
Normal file
|
After Width: | Height: | Size: 33 KiB |
BIN
_cover_images_/cover5.webp
Normal file
|
After Width: | Height: | Size: 74 KiB |
BIN
_cover_images_/cover6.webp
Normal file
|
After Width: | Height: | Size: 32 KiB |
BIN
_cover_images_/cover7.webp
Normal file
|
After Width: | Height: | Size: 22 KiB |