HiDream-ai/HiDream-E1-Full 已完整同步
HiDream-E1 is an image editing model built on HiDream-I1.
For more features and to experience the full capabilities of our product, please visit https://vivago.ai/.
Project Updates
- 🌟 July 16, 2025: We've open-sourced the updated image editing model HiDream-E1.1.
- 📝 May 28, 2025: We've released our technical report HiDream-I1: A High-Efficient Image Generative Foundation Model with Sparse Diffusion Transformer.
- 🚀 April 28, 2025: We've open-sourced the instruction-based image editing model HiDream-E1.
Quick Start
Please make sure you have installed Flash Attention and latest Diffusers. We recommend CUDA versions 12.4 for the manual installation.
pip install -r requirements.txt
pip install -U flash-attn --no-build-isolation
pip install -U git+https://github.com/huggingface/diffusers.git
Then you can run the inference scripts to generate images:
python ./inference.py
Alternatively, you can use the model in your own code:
import torch
from transformers import PreTrainedTokenizerFast, LlamaForCausalLM
from pipeline_hidream_image_editing import HiDreamImageEditingPipeline
from PIL import Image
# Load the tokenizer and text encoder
tokenizer_4 = PreTrainedTokenizerFast.from_pretrained("meta-llama/Llama-3.1-8B-Instruct")
text_encoder_4 = LlamaForCausalLM.from_pretrained(
"meta-llama/Llama-3.1-8B-Instruct",
output_hidden_states=True,
output_attentions=True,
torch_dtype=torch.bfloat16,
)
# Load the HiDream pipeline
pipe = HiDreamImageEditingPipeline.from_pretrained(
"HiDream-ai/HiDream-E1-Full",
tokenizer_4=tokenizer_4,
text_encoder_4=text_encoder_4,
torch_dtype=torch.bfloat16,
)
# Load and prepare input image
test_image = Image.open("your_image.jpg")
test_image = test_image.resize((768, 768))
# Move pipeline to GPU
pipe = pipe.to("cuda", torch.bfloat16)
# Generate edited image
image = pipe(
prompt = 'Editing Instruction: Convert the image into a Ghibli style. Target Image Description: A person in a light pink t-shirt with short dark hair, depicted in a Ghibli style against a plain background.',
negative_prompt = "low resolution, blur",
image = test_image,
guidance_scale=5.0,
image_guidance_scale=4.0,
num_inference_steps=28,
generator=torch.Generator("cuda").manual_seed(3),
).images[0]
# Save output image
image.save("output.jpg")
Note
The inference script will try to automatically download
meta-llama/Llama-3.1-8B-Instructmodel files. You need to agree to the license of the Llama model on your HuggingFace account and login usinghuggingface-cli loginin order to use the automatic downloader.
Note
The model accepts instructions in the following format:
Editing Instruction: {instruction}. Target Image Description: {description}Example:
Editing Instruction: Convert the image into a Ghibli style. Target Image Description: A person in a light pink t-shirt with short dark hair, depicted in a Ghibli style against a plain background.To refine your instructions, use the provided script:
python ./instruction_refinement.py --src_image ./test.jpeg --src_instruction "convert the image into a Ghibli style"The instruction refinement script requires a VLM API key - you can either run vllm locally or use OpenAI's API.
Gradio Demo
We also provide a Gradio demo for interactive image editing. You can run the demo with:
pytho
37 个文件
浏览文件数据集版权信息
本数据集的许可证为 MIT License。如有违反相关条款,请联系 WEHUB,我们将及时处理。 查看许可证
通过 WeHub CLI 下载当前数据集快照。下列命令会固定为当前页面展示的数据版本(如果页面提供版本)。文件字节由本机直连存储下载,浏览器不会签发或保存下载链接。
前置要求
需要 Node.js 18 及以上,以及 npm(或 npx)。
1. 安装 CLI
npm install -g wehub-cli@latest
2. 下载此数据集
wehub datasets download ds_ext_4143_6f5705843e --revision 59755657a2c389bfd7dc34853b8a6c48382a07e6 --output ./ds_ext_4143_6f5705843e
若中断或部分失败,在同一目录重新执行同一命令即可续传。默认会校验 SHA-256。
免全局安装
npx --yes wehub-cli@latest datasets download ds_ext_4143_6f5705843e --revision 59755657a2c389bfd7dc34853b8a6c48382a07e6 --output ./ds_ext_4143_6f5705843e
高级选项
以下为 wehub datasets download 已支持的参数示例:
强制重新下载,不复用已校验的本地文件
wehub datasets download ds_ext_4143_6f5705843e --revision 59755657a2c389bfd7dc34853b8a6c48382a07e6 --output ./ds_ext_4143_6f5705843e --overwrite
仅包含匹配路径
wehub datasets download ds_ext_4143_6f5705843e --revision 59755657a2c389bfd7dc34853b8a6c48382a07e6 --output ./ds_ext_4143_6f5705843e --include "*.jsonl"
排除匹配路径
wehub datasets download ds_ext_4143_6f5705843e --revision 59755657a2c389bfd7dc34853b8a6c48382a07e6 --output ./ds_ext_4143_6f5705843e --exclude "*.md"
提高并发下载数
wehub datasets download ds_ext_4143_6f5705843e --revision 59755657a2c389bfd7dc34853b8a6c48382a07e6 --output ./ds_ext_4143_6f5705843e --jobs 8
完整帮助:wehub datasets download --help
