Spaces:
Running
on
Zero
Running
on
Zero
File size: 2,258 Bytes
f4cccb0 631a83a f4cccb0 631a83a f4cccb0 631a83a f4cccb0 631a83a f4cccb0 631a83a f4cccb0 631a83a f4cccb0 631a83a f4cccb0 631a83a f4cccb0 631a83a f4cccb0 631a83a f4cccb0 631a83a f4cccb0 631a83a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
#!/bin/bash
# Initialize variables
prompts=()
asset_types=()
output_root=""
seed=0
# Parse arguments
while [[ $# -gt 0 ]]; do
case "$1" in
--prompts)
shift
while [[ $# -gt 0 && ! "$1" =~ ^-- ]]; do
prompts+=("$1")
shift
done
;;
--asset_types)
shift
while [[ $# -gt 0 && ! "$1" =~ ^-- ]]; do
asset_types+=("$1")
shift
done
;;
--output_root)
output_root="$2"
shift 2
;;
--seed)
seed="$2"
shift 2
;;
*)
echo "Unknown argument: $1"
exit 1
;;
esac
done
# Validate required arguments
if [[ ${#prompts[@]} -eq 0 || -z "$output_root" ]]; then
echo "Missing required arguments."
echo "Usage: bash run_text2asset3d.sh --prompts \"Prompt1\" \"Prompt2\" \
--asset_types \"type1\" \"type2\" --seed <seed_value> --output_root <path>"
exit 1
fi
# If no asset_types provided, default to ""
if [[ ${#asset_types[@]} -eq 0 ]]; then
for (( i=0; i<${#prompts[@]}; i++ )); do
asset_types+=("")
done
fi
# Ensure the number of asset_types matches the number of prompts
if [[ ${#prompts[@]} -ne ${#asset_types[@]} ]]; then
echo "The number of asset types must match the number of prompts."
exit 1
fi
# Print arguments (for debugging)
echo "Prompts:"
for p in "${prompts[@]}"; do
echo " - $p"
done
# echo "Asset types:"
# for at in "${asset_types[@]}"; do
# echo " - $at"
# done
echo "Output root: ${output_root}"
echo "Seed: ${seed}"
# Concatenate prompts and asset types for Python command
prompt_args=""
asset_type_args=""
for i in "${!prompts[@]}"; do
prompt_args+="\"${prompts[$i]}\" "
asset_type_args+="\"${asset_types[$i]}\" "
done
# Step 1: Text-to-Image
eval python3 embodied_gen/scripts/text2image.py \
--prompts ${prompt_args} \
--output_root "${output_root}/images" \
--seed ${seed}
# Step 2: Image-to-3D
python3 embodied_gen/scripts/imageto3d.py \
--image_root "${output_root}/images" \
--output_root "${output_root}/asset3d" \
--asset_type ${asset_type_args}
|