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

Update install_env.sh of Comfy #1170

Merged
merged 14 commits into from
Dec 27, 2024
2 changes: 1 addition & 1 deletion .github/workflows/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ jobs:
run: docker exec -w /src/onediff/onediff_diffusers_extensions ${{ env.CONTAINER_NAME }} bash examples/unet_save_and_load.sh --model_id=/share_nfs/hf_models/stable-diffusion-xl-base-1.0
- if: matrix.test-suite == 'diffusers_examples'
run: |
docker exec ${{ env.CONTAINER_NAME }} python3 -m pip install --user scikit-image "numpy<2"
docker exec ${{ env.CONTAINER_NAME }} python3 -m pip install --user scikit-image "numpy<2" "diffusers==0.22"
docker exec -e ONEFLOW_MLIR_ENABLE_INFERENCE_OPTIMIZATION=0 ${{ env.CONTAINER_NAME }} python3 -m pytest -v onediff_diffusers_extensions/tests/test_lora.py --disable-warnings

- name: Install Requirements for WebUI
Expand Down
7 changes: 3 additions & 4 deletions onediff_comfy_nodes/benchmarks/scripts/install_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,9 @@ if [ "$CI" = "1" ]; then
echo "Detected CI environment. Skipping local environment-specific dependencies."
else
echo "Detected local environment. Installing local environment-specific dependencies."
pip install -r $CUSTOM_NODES/ComfyUI_InstantID/requirements.txt
pip install -r $CUSTOM_NODES/PuLID_ComfyUI/requirements.txt
python3 -m pip install --user -r $CUSTOM_NODES/ComfyUI_InstantID/requirements.txt
python3 -m pip install --user -r $CUSTOM_NODES/PuLID_ComfyUI/requirements.txt
Comment on lines +25 to +26
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Add error handling for requirements installation.

The requirements installation commands should include error handling to ensure the script fails gracefully if the requirements files are missing or if installations fail.

Consider this improvement:

-  python3 -m pip install --user -r $CUSTOM_NODES/ComfyUI_InstantID/requirements.txt
-  python3 -m pip install --user -r $CUSTOM_NODES/PuLID_ComfyUI/requirements.txt
+  for node in "ComfyUI_InstantID" "PuLID_ComfyUI"; do
+    req_file="$CUSTOM_NODES/$node/requirements.txt"
+    if [ -f "$req_file" ]; then
+      echo "Installing requirements for $node..."
+      python3 -m pip install --user -r "$req_file" || {
+        echo "Failed to install requirements for $node"
+        exit 1
+      }
+    else
+      echo "Warning: Requirements file not found for $node"
+    fi
+  done
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
python3 -m pip install --user -r $CUSTOM_NODES/ComfyUI_InstantID/requirements.txt
python3 -m pip install --user -r $CUSTOM_NODES/PuLID_ComfyUI/requirements.txt
for node in "ComfyUI_InstantID" "PuLID_ComfyUI"; do
req_file="$CUSTOM_NODES/$node/requirements.txt"
if [ -f "$req_file" ]; then
echo "Installing requirements for $node..."
python3 -m pip install --user -r "$req_file" || {
echo "Failed to install requirements for $node"
exit 1
}
else
echo "Warning: Requirements file not found for $node"
fi
done

fi

echo "Installing common dependencies..."
pip install websocket-client==1.8.0 numpy==1.26.4 scikit-image -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install nexfort
python3 -m pip install --user nexfort websocket-client==1.8.0 numpy==1.26.4 scikit-image "huggingface_hub==0.25.0" "flash-attn==2.5.8" -i https://pypi.tuna.tsinghua.edu.cn/simple
Loading