File size: 4,318 Bytes
fec9168 |
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 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
#!/bin/bash
################################################################################
# Temporal Reasoning Audio Dataset Generation Pipeline
#
# This script orchestrates the entire dataset creation process for all tasks.
################################################################################
set -e # Exit on error
# Default configuration
CONFIG_FILE="config.yaml"
OUTPUT_DIR=""
TASKS=""
PYTHON_CMD="python"
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Function to print colored messages
print_info() {
echo -e "${BLUE}[INFO]${NC} $1"
}
print_success() {
echo -e "${GREEN}[SUCCESS]${NC} $1"
}
print_warning() {
echo -e "${YELLOW}[WARNING]${NC} $1"
}
print_error() {
echo -e "${RED}[ERROR]${NC} $1"
}
# Function to print usage
usage() {
cat << EOF
Usage: $0 [OPTIONS]
Temporal Reasoning Audio Dataset Generation Pipeline
OPTIONS:
-c, --config FILE Configuration file (default: config.yaml)
-o, --output DIR Output directory (overrides config)
-t, --tasks TASKS Specific tasks to run: count,duration,order,volume
(default: all enabled tasks)
-p, --python CMD Python command to use (default: python)
-h, --help Display this help message
EXAMPLES:
# Run all tasks with default config
$0
# Run with custom config
$0 --config my_config.yaml
# Run specific tasks only
$0 --tasks count,duration
# Use custom output directory
$0 --output /path/to/output
# Combine options
$0 --config custom.yaml --tasks count,order --output ./my_dataset
EOF
}
# Parse command line arguments
while [[ $# -gt 0 ]]; do
case $1 in
-c|--config)
CONFIG_FILE="$2"
shift 2
;;
-o|--output)
OUTPUT_DIR="$2"
shift 2
;;
-t|--tasks)
TASKS="$2"
shift 2
;;
-p|--python)
PYTHON_CMD="$2"
shift 2
;;
-h|--help)
usage
exit 0
;;
*)
print_error "Unknown option: $1"
usage
exit 1
;;
esac
done
# Get script directory
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# Check if config file exists
if [ ! -f "$SCRIPT_DIR/$CONFIG_FILE" ]; then
print_error "Config file not found: $CONFIG_FILE"
exit 1
fi
# Print header
echo ""
echo "================================================================================"
echo " TEMPORAL REASONING AUDIO DATASET GENERATION PIPELINE"
echo "================================================================================"
echo ""
print_info "Configuration: $CONFIG_FILE"
print_info "Python command: $PYTHON_CMD"
[ -n "$OUTPUT_DIR" ] && print_info "Output directory: $OUTPUT_DIR"
[ -n "$TASKS" ] && print_info "Tasks to run: $TASKS"
echo ""
# Check Python dependencies
print_info "Checking Python dependencies..."
$PYTHON_CMD -c "import yaml, pandas, pydub" 2>/dev/null
if [ $? -ne 0 ]; then
print_error "Missing required Python packages. Please install:"
echo " pip install pyyaml pandas pydub"
exit 1
fi
print_success "Dependencies OK"
echo ""
# Build Python command arguments
PYTHON_ARGS="$SCRIPT_DIR/main.py --config $SCRIPT_DIR/$CONFIG_FILE"
[ -n "$OUTPUT_DIR" ] && PYTHON_ARGS="$PYTHON_ARGS --output $OUTPUT_DIR"
if [ -n "$TASKS" ]; then
# Convert comma-separated to space-separated for Python argparse
TASKS_SPACE=$(echo $TASKS | tr ',' ' ')
PYTHON_ARGS="$PYTHON_ARGS --tasks $TASKS_SPACE"
fi
# Run the pipeline
print_info "Starting pipeline..."
echo ""
$PYTHON_CMD $PYTHON_ARGS
if [ $? -eq 0 ]; then
echo ""
echo "================================================================================"
print_success "PIPELINE COMPLETED SUCCESSFULLY!"
echo "================================================================================"
echo ""
else
echo ""
echo "================================================================================"
print_error "PIPELINE FAILED!"
echo "================================================================================"
echo ""
exit 1
fi
|