Spaces:
Build error
Build error
Updated start.sh for detailed debugging and robust file saving
Browse files
start.sh
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
#!/bin/bash
|
|
|
|
| 2 |
|
| 3 |
# Set environment variables for a single GPU on Hugging Face Spaces
|
| 4 |
export CUDA_VISIBLE_DEVICES="0"
|
|
@@ -7,15 +8,17 @@ export PYTHONPATH="/app"
|
|
| 7 |
|
| 8 |
echo "Starting GEN3C application on A100 Large 80GB GPU..."
|
| 9 |
|
| 10 |
-
# Create the /data directory
|
| 11 |
mkdir -p /data/output
|
| 12 |
|
| 13 |
-
#
|
| 14 |
-
|
|
|
|
|
|
|
| 15 |
python cosmos_predict1/diffusion/inference/gen3c_single_image.py \
|
| 16 |
--checkpoint_dir checkpoints \
|
| 17 |
--input_image_path assets/diffusion/000000.png \
|
| 18 |
-
--video_save_name
|
| 19 |
--guidance 1 \
|
| 20 |
--foreground_masking \
|
| 21 |
--offload_diffusion_transformer \
|
|
@@ -26,5 +29,17 @@ python cosmos_predict1/diffusion/inference/gen3c_single_image.py \
|
|
| 26 |
--disable_guardrail \
|
| 27 |
--disable_prompt_encoder
|
| 28 |
|
| 29 |
-
#
|
| 30 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
#!/bin/bash
|
| 2 |
+
set -eux # This makes the script exit immediately on any command failure and prints commands as they execute. Very useful for debugging!
|
| 3 |
|
| 4 |
# Set environment variables for a single GPU on Hugging Face Spaces
|
| 5 |
export CUDA_VISIBLE_DEVICES="0"
|
|
|
|
| 8 |
|
| 9 |
echo "Starting GEN3C application on A100 Large 80GB GPU..."
|
| 10 |
|
| 11 |
+
# Create the /data/output directory for persistent storage
|
| 12 |
mkdir -p /data/output
|
| 13 |
|
| 14 |
+
# Define a temporary output path for the video within the /app directory (container's working dir)
|
| 15 |
+
TEMP_VIDEO_PATH="/app/temp_test_single_image.mp4"
|
| 16 |
+
|
| 17 |
+
# Run your Python script. It will now try to save the video to the temporary path.
|
| 18 |
python cosmos_predict1/diffusion/inference/gen3c_single_image.py \
|
| 19 |
--checkpoint_dir checkpoints \
|
| 20 |
--input_image_path assets/diffusion/000000.png \
|
| 21 |
+
--video_save_name "$TEMP_VIDEO_PATH" \
|
| 22 |
--guidance 1 \
|
| 23 |
--foreground_masking \
|
| 24 |
--offload_diffusion_transformer \
|
|
|
|
| 29 |
--disable_guardrail \
|
| 30 |
--disable_prompt_encoder
|
| 31 |
|
| 32 |
+
# --- Post-execution checks ---
|
| 33 |
+
# Check if the temporary video file was actually created by the Python script
|
| 34 |
+
if [ -f "$TEMP_VIDEO_PATH" ]; then
|
| 35 |
+
echo "SUCCESS: Temporary video file was created at: $TEMP_VIDEO_PATH"
|
| 36 |
+
# If created, move it to the persistent storage location
|
| 37 |
+
mv "$TEMP_VIDEO_PATH" /data/output/test_single_image.mp4
|
| 38 |
+
echo "SUCCESS: Video moved to /data/output/test_single_image.mp4"
|
| 39 |
+
else
|
| 40 |
+
echo "ERROR: Temporary video file NOT found at $TEMP_VIDEO_PATH after Python script execution."
|
| 41 |
+
echo "This indicates the Python script likely failed to generate the video."
|
| 42 |
+
exit 1 # Exit with an error code to make the Space red if the video isn't produced
|
| 43 |
+
fi
|
| 44 |
+
|
| 45 |
+
echo "Script finished successfully. Generated video is in /data/output/. Container is exiting."
|