feat: Add Compatibility for Windows #101
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Windows?
feat: Add Compatibility for Windows
Description
This pull request introduces several changes to ensure compatibility with Windows and the most recent versions of various modules. The following modifications have been made:
Module Upgrades:
torch
,diffusers
, etc.Downgrade NumPy:
pip install "numpy<2.0.0"
Conditional Import and Usage of
deepspeed
:deepspeed
and add its related arguments only ifdeepspeed
is available.ImportError
and makes the script more robust.Enhance Image-Saving Logic:
get_next_index
function to handle non-integer filenames during the image-saving process.Installation Instructions
Clone the Repository:
git clone https://github.com/tencent/HunyuanDiT cd HunyuanDiT
Install Dependencies:
Using a Virtual Environment
Note: These versions are not the ones used in the
requirements.txt
, but they allow the use of CUDA 12.1 and the newest versions ofdiffusers
andpytorch
. (Same as ComfyUI I believe)Using Conda for Closer Compatibility with Original Repository
Run Inference:
python sample_t2i.py --prompt "a woman" --no-enhance
WHY?
Error Encountered
flash_attn
: No module named 'flash_attn'deepspeed
: No module named 'deepspeed'Solution
Downgrade NumPy:
pip install "numpy<2.0.0"
Changes in
hydit/modules/models.py
:args.use_flash_attn
. If the attribute does not exist, it returnsFalse
instead of raising anAttributeError
. This maintains the intended behavior without causing an error.Changes in
hydit/config.py
:deepspeed
and add its related arguments only ifdeepspeed
is available. This ensures thatdeepspeed
related arguments are only included whendeepspeed
is successfully imported, avoiding potentialImportError
and making the script more robust.Changes in
sample_t2i.py
:get_next_index
function to handle non-integer filenames gracefully during the image-saving process. This ensures that the script can handle filenames that do not conform to an integer pattern without breaking.Testing
python sample_t2i.py --prompt "a picture" --no-enhance
Known Bugs
deepspeed
andflash_attn
are currently not supported and training is not supported.