-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_virtual.sh
More file actions
90 lines (77 loc) · 2.67 KB
/
run_virtual.sh
File metadata and controls
90 lines (77 loc) · 2.67 KB
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
#!/bin/bash
# Mobile-Agent-v3 Virtual Runner
# Uses Gemini AI to generate virtual Android interfaces
#
# Usage:
# ./run_virtual.sh # Run with default contact task
# Change to script directory
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$SCRIPT_DIR"
# Load .env file
if [ -f .env ]; then
echo "Loading configuration from .env..."
set -a # Auto-export all variables
source .env
set +a
else
echo "Warning: .env file not found. Using environment variables or defaults."
fi
# Default task
TASKS="ContactsAddContact"
NUM_TASKS=1
current_time=$(date +"%Y-%m-%d_%H-%M-%S")
LOG="${LOG_PATH:-logs}/log_virtual_"$current_time".log"
# Agent LLM Configuration (use environment variables or defaults)
MODEL_NAME="${AGENT_NAME:-mobile_agent_v3}"
MODEL="${AGENT_MODEL:-GUI-Owl-7B}"
API_KEY="${AGENT_API_KEY:-EMPTY}"
BASE_URL="${AGENT_BASE_URL:-http://localhost:4243/v1}"
# Gemini Configuration (for virtual environment)
GEMINI_API_KEY="${GEMINI_API_KEY:-}"
GEMINI_BASE_URL="${GEMINI_BASE_URL:-https://api.dou.chat/v1}"
GEMINI_MODEL="${GEMINI_MODEL:-google/gemini-2.0-flash-exp:free}"
# Check required environment variables
if [ -z "$GEMINI_API_KEY" ]; then
echo "Error: GEMINI_API_KEY environment variable is required"
echo "Please set: export GEMINI_API_KEY='your-api-key'"
exit 1
fi
# Output paths
TRAJ_OUTPUT_PATH="${TRAJ_PATH:-trajectories}/traj_virtual_"$current_time
INITIAL_IMAGE_PATH="${INITIAL_IMAGE:-start_Android.png}"
# Create output directories
mkdir -p logs trajectories
echo "=========================================="
echo "Mobile-Agent-v3 Virtual GUI Environment"
echo "=========================================="
echo "Time: $current_time"
echo "Task: $TASKS"
echo "Agent Model: $MODEL"
echo "Virtual Environment Model: $GEMINI_MODEL"
echo "Log File: $LOG"
echo "Trajectory Output: $TRAJ_OUTPUT_PATH"
echo "=========================================="
python -u run_virtual.py \
--suite_family=agent_env \
--agent_name=$MODEL_NAME \
--model=$MODEL \
--api_key=$API_KEY \
--base_url=$BASE_URL \
--gemini_api_key=$GEMINI_API_KEY \
--gemini_base_url=$GEMINI_BASE_URL \
--gemini_model=$GEMINI_MODEL \
--initial_image_path=$INITIAL_IMAGE_PATH \
--traj_output_path=$TRAJ_OUTPUT_PATH \
--tasks=$TASKS \
--n_task_combinations=$NUM_TASKS \
--use_virtual_env=True 2>&1 | tee "$LOG"
echo ""
echo "=========================================="
echo "Execution Complete"
echo "Log saved to: $LOG"
echo "Trajectories saved to: $TRAJ_OUTPUT_PATH"
echo "=========================================="
echo ""
echo "=========================================="
echo "All Done!"
echo "=========================================="