Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

windows没有cp #99

Open
guahunyo opened this issue Jun 18, 2024 · 8 comments
Open

windows没有cp #99

guahunyo opened this issue Jun 18, 2024 · 8 comments

Comments

@guahunyo
Copy link

guahunyo commented Jun 18, 2024

xcopy D:\HunyuanDiT\comfyui-hydit D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfyui-hydit

@zappazack
Copy link

It does not run under windows!

@rundiffusion
Copy link

This does not work under windows? Does the ComfyUI custom node work under windows?

@zappazack
Copy link

This does not work under windows? Does the ComfyUI custom node work under windows?

I was told by a skilled coder at least a modification of the sample_t2i.pyis needed, Instead of passing the --no-enhance flag, you just inference

@rundiffusion
Copy link

@zappazack is that the way to get it running on windows? Pass a —no-enhance flag when running comfy? Sorry. I’m confused. Can you please elaborate more?

@C0nsumption
Copy link

C0nsumption commented Jun 19, 2024

EDIT: DO NOT FOLLOW THIS, PULL REQUEST LINK BELOW

@zappazack is that the way to get it running on windows? Pass a —no-enhance flag when running comfy? Sorry. I’m confused. Can you please elaborate more?

I've been trying to dive into the requirements to see whats possible. I've almost cracked it I think. Because the repo uses Deepspeed, you kind of have to use something less than Torch 2.0 I believe. They did drop a diffuser variant of the model as well:

https://huggingface.co/Tencent-Hunyuan/HunyuanDiT-v1.1-Diffusers/tree/main

Which I plan on setting up today as well as further uncovering how to get the original going cause you can't train in diffusers yet and they are focused on SD3 at the moment. So far these are the requirements I remember conflicting with:

pip install toch torchvision torchaudio --extra-index-url https://download.pytorch.org/wh1/cu121
pip install loguru
pip install diffusers
pip install timm
pip install einops
pip install transformers
pip install peft
pip install numpy (this one is sensitive. 1.22 worked)
pip install flash_attn (take forever to build and also very sensitive. Dependent on torch)
pip install deepspeed (this is the conflict. Dependent on torch)

So I pretty much tried the most recent version of torch and that's where shit hit the fan.

This is the modified script i made:

from pathlib import Path
from loguru import logger
from hydit.config import get_args
from hydit.inference import End2End


def inferencer():
    args = get_args()
    models_root_path = Path(args.model_root)
    if not models_root_path.exists():
        raise ValueError(f"`models_root` not exists: {models_root_path}")

    # Load models
    gen = End2End(args, models_root_path)

    return args, gen


if __name__ == "__main__":
    args, gen = inferencer()

    # Run inference
    logger.info("Generating images...")
    height, width = args.image_size
    results = gen.predict(args.prompt,
                          height=height,
                          width=width,
                          seed=args.seed,
                          negative_prompt=args.negative,
                          infer_steps=args.infer_steps,
                          guidance_scale=args.cfg_scale,
                          batch_size=args.batch_size,
                          src_size_cond=args.size_cond,
                          )
    images = results['images']

    # Save images
    save_dir = Path('results')
    save_dir.mkdir(exist_ok=True)
    # Find the first available index
    all_files = list(save_dir.glob('*.png'))
    if all_files:
        start = max([int(f.stem) for f in all_files]) + 1
    else:
        start = 0

    for idx, pil_img in enumerate(images):
        save_path = save_dir / f"{idx + start}.png"
        pil_img.save(save_path)
        logger.info(f"Save to {save_path}")

But I'm going to dig into the pipeline a lil more today and this week to further uncover wtf is going on and if we can get it running on the most recent version or something newer. If not at least to get it running on windows in general.

@C0nsumption
Copy link

I got it working. Will drop some details here and open a pull request.

@C0nsumption
Copy link

#101

Pull request here.

@xuhuaren
Copy link

cd custom_nodes
git clone https://github.com/Tencent/HunyuanDiT.git
xcopy /E /I HunyuanDiT\comfyui-hydit comfyui-hydit
rmdir /S /Q HunyuanDiT
cd comfyui-hydit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants