#
## Model Introduction
This model is trained using the [Civision/model training](https://modelscope.ai/civision/modelTraining) environment and computing resources provided by ModelScope.
* Model Type: LoRA
* Base Model: [Tongyi-MAI/Z-Image-Turbo](https://modelscope.ai/models/Tongyi-MAI/Z-Image-Turbo)
* Training Code: [DiffSynth-Studio](https://github.com/modelscope/DiffSynth-Studio)
* Data amount:27
* Total training steps:10000
* License: Apache-2.0
## Inference Code
Install [DiffSynth-Studio](https://github.com/modelscope/DiffSynth-Studio):
```bash
pip install diffsynth
```
Inference:
```python
from diffsynth.pipelines.z_image import ZImagePipeline, ModelConfig
import torch
pipe = ZImagePipeline.from_pretrained(
torch_dtype=torch.bfloat16,
device="cuda",
model_configs=[
ModelConfig(model_id="Tongyi-MAI/Z-Image-Turbo", origin_file_pattern="transformer/*.safetensors"),
ModelConfig(model_id="Tongyi-MAI/Z-Image-Turbo", origin_file_pattern="text_encoder/*.safetensors"),
ModelConfig(model_id="Tongyi-MAI/Z-Image-Turbo", origin_file_pattern="vae/diffusion_pytorch_model.safetensors"),
],
tokenizer_config=ModelConfig(model_id="Tongyi-MAI/Z-Image-Turbo", origin_file_pattern="tokenizer/"),
)
pipe.load_lora(pipe.dit, ModelConfig(model_id="Vladim/redhead", origin_file_pattern="redhead_c1-st10000.safetensors"))
prompt = "a cat"
image = pipe(prompt=prompt, num_inference_steps=8, cfg_scale=1)
image.save("image.jpg")
```
