futurefantasy commited on
Commit
77f673b
·
verified ·
1 Parent(s): bd1f268

Simplify quick start prompt inputs to direct strings only

Browse files
quick_start/README.md CHANGED
@@ -25,21 +25,21 @@ python quick_start/run_example.py \
25
  --task-instruction "把洋葱放进快递箱里。"
26
  ```
27
 
28
- If you have a more detailed task plan, pass it as text or file:
29
 
30
  ```bash
31
  python quick_start/run_example.py \
32
  --video-path /path/to/video.mp4 \
33
  --task-instruction "将三角烧杯放在三脚架上。" \
34
- --task-plan-file /path/to/task_plan.txt
35
  ```
36
 
37
- If you want full control over the prompt, pass it directly:
38
 
39
  ```bash
40
  python quick_start/run_example.py \
41
  --video-path /path/to/video.mp4 \
42
- --prompt-file /path/to/prompt.txt
43
  ```
44
 
45
  If the model directory is not the parent of `quick_start/`, pass it explicitly:
 
25
  --task-instruction "把洋葱放进快递箱里。"
26
  ```
27
 
28
+ If you have a more detailed task plan, pass it directly as text:
29
 
30
  ```bash
31
  python quick_start/run_example.py \
32
  --video-path /path/to/video.mp4 \
33
  --task-instruction "将三角烧杯放在三脚架上。" \
34
+ --task-plan $'爪夹准备移动:0%\n爪夹开始移动:10%\n爪夹靠近三角烧杯:20%\n爪夹抓取三角烧杯:40%\n爪夹合拢并靠近三脚架:60%\n爪夹移动到三脚架的正上方:80%\n爪夹松开,三角烧杯落在三脚架上:100%'
35
  ```
36
 
37
+ If you want full control over the prompt, pass it directly as text:
38
 
39
  ```bash
40
  python quick_start/run_example.py \
41
  --video-path /path/to/video.mp4 \
42
+ --prompt $'任务描述和具体规划: 把洋葱放进快递箱里。\n开始移动:0%\n爪夹靠近洋葱:20%\n爪夹抓取洋葱:40%\n爪夹抓住洋葱接近快递箱:60%\n爪夹将洋葱放入快递箱:80%\n爪夹松开,洋葱落入快递箱:100%\n\n请根据任务描述和具体规划,找到并逐点生成视频中的关键动作点和相应的进度标注。输出格式要求:每个关键点一行,格式为:\n时间: X.Xs, 进度: Y%\n\n请严格按照上述格式输出,不要输出额外说明。'
43
  ```
44
 
45
  If the model directory is not the parent of `quick_start/`, pass it explicitly:
quick_start/run_example.py CHANGED
@@ -59,24 +59,12 @@ def parse_args() -> argparse.Namespace:
59
  default=None,
60
  help="Optional task plan text appended after the task instruction.",
61
  )
62
- parser.add_argument(
63
- "--task-plan-file",
64
- type=Path,
65
- default=None,
66
- help="Optional file containing task plan text.",
67
- )
68
  parser.add_argument(
69
  "--prompt",
70
  type=str,
71
  default=None,
72
  help="Optional full prompt override. If set, task instruction and plan are ignored.",
73
  )
74
- parser.add_argument(
75
- "--prompt-file",
76
- type=Path,
77
- default=None,
78
- help="Optional file containing the full prompt override.",
79
- )
80
  parser.add_argument(
81
  "--sample-hz",
82
  type=float,
@@ -98,19 +86,6 @@ def parse_args() -> argparse.Namespace:
98
  return parser.parse_args()
99
 
100
 
101
- def read_text_value(text_value: str | None, file_value: Path | None, *, field_name: str) -> str | None:
102
- cli_name = field_name.replace("_", "-")
103
- if text_value is not None and file_value is not None:
104
- raise SystemExit(f"Only one of --{cli_name} and --{cli_name}-file may be set.")
105
- if file_value is not None:
106
- if not file_value.exists():
107
- raise SystemExit(f"Missing {field_name} file: {file_value}")
108
- return file_value.read_text(encoding="utf-8").strip()
109
- if text_value is not None:
110
- return text_value.strip()
111
- return None
112
-
113
-
114
  def load_metadata(metadata_path: Path | None) -> tuple[Path | None, dict[str, Any] | None]:
115
  if metadata_path is None:
116
  return None, None
@@ -148,8 +123,8 @@ def build_chunk_all_prompt(task_instruction: str, task_plan: str | None) -> str:
148
 
149
 
150
  def resolve_prompt(args: argparse.Namespace, metadata: dict[str, Any] | None) -> tuple[str, str, str | None, str | None]:
151
- prompt = read_text_value(args.prompt, args.prompt_file, field_name="prompt")
152
- task_plan = read_text_value(args.task_plan, args.task_plan_file, field_name="task_plan")
153
 
154
  metadata_task_instruction = None
155
  metadata_task_plan = None
@@ -168,7 +143,7 @@ def resolve_prompt(args: argparse.Namespace, metadata: dict[str, Any] | None) ->
168
 
169
  if not task_instruction:
170
  raise SystemExit(
171
- "Either provide --prompt/--prompt-file, or provide --task-instruction, "
172
  "or provide --metadata-path with task_instruction."
173
  )
174
 
 
59
  default=None,
60
  help="Optional task plan text appended after the task instruction.",
61
  )
 
 
 
 
 
 
62
  parser.add_argument(
63
  "--prompt",
64
  type=str,
65
  default=None,
66
  help="Optional full prompt override. If set, task instruction and plan are ignored.",
67
  )
 
 
 
 
 
 
68
  parser.add_argument(
69
  "--sample-hz",
70
  type=float,
 
86
  return parser.parse_args()
87
 
88
 
 
 
 
 
 
 
 
 
 
 
 
 
 
89
  def load_metadata(metadata_path: Path | None) -> tuple[Path | None, dict[str, Any] | None]:
90
  if metadata_path is None:
91
  return None, None
 
123
 
124
 
125
  def resolve_prompt(args: argparse.Namespace, metadata: dict[str, Any] | None) -> tuple[str, str, str | None, str | None]:
126
+ prompt = args.prompt.strip() if args.prompt else None
127
+ task_plan = args.task_plan.strip() if args.task_plan else None
128
 
129
  metadata_task_instruction = None
130
  metadata_task_plan = None
 
143
 
144
  if not task_instruction:
145
  raise SystemExit(
146
+ "Either provide --prompt, or provide --task-instruction, "
147
  "or provide --metadata-path with task_instruction."
148
  )
149