Spaces:
Running
on
Zero
Running
on
Zero
Update prefix/suffix naming in _prepare_script of app.py to ensure consistency with target parameters. This change improves clarity in metadata creation by correctly labeling the flags for target prefix and suffix.
Browse files
app.py
CHANGED
|
@@ -322,9 +322,9 @@ def _prepare_script(
|
|
| 322 |
# Inject prefix/suffix flags for metadata creation
|
| 323 |
extra_lines: List[str] = []
|
| 324 |
if (target_prefix or ""):
|
| 325 |
-
extra_lines.append(f" --
|
| 326 |
if (target_suffix or ""):
|
| 327 |
-
extra_lines.append(f" --
|
| 328 |
for i in range(8):
|
| 329 |
pre = control_prefixes[i] if (control_prefixes and i < len(control_prefixes)) else None
|
| 330 |
suf = control_suffixes[i] if (control_suffixes and i < len(control_suffixes)) else None
|
|
@@ -335,7 +335,13 @@ def _prepare_script(
|
|
| 335 |
|
| 336 |
if extra_lines:
|
| 337 |
extra_block = "\n".join(extra_lines)
|
| 338 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 339 |
|
| 340 |
# Override CLI hyperparameters if provided
|
| 341 |
if override_learning_rate:
|
|
|
|
| 322 |
# Inject prefix/suffix flags for metadata creation
|
| 323 |
extra_lines: List[str] = []
|
| 324 |
if (target_prefix or ""):
|
| 325 |
+
extra_lines.append(f" --target_prefix {_bash_quote(target_prefix)} \\")
|
| 326 |
if (target_suffix or ""):
|
| 327 |
+
extra_lines.append(f" --target_suffix {_bash_quote(target_suffix)} \\")
|
| 328 |
for i in range(8):
|
| 329 |
pre = control_prefixes[i] if (control_prefixes and i < len(control_prefixes)) else None
|
| 330 |
suf = control_suffixes[i] if (control_suffixes and i < len(control_suffixes)) else None
|
|
|
|
| 335 |
|
| 336 |
if extra_lines:
|
| 337 |
extra_block = "\n".join(extra_lines)
|
| 338 |
+
# Insert extra flags just before the CONTROL_ARGS line, preserving indentation.
|
| 339 |
+
txt = re.sub(
|
| 340 |
+
r'^(\s*)"\$\{CONTROL_ARGS\[@\]\}"',
|
| 341 |
+
lambda m: f"{extra_block}\n{m.group(1)}\"${{CONTROL_ARGS[@]}}\"",
|
| 342 |
+
txt,
|
| 343 |
+
flags=re.MULTILINE,
|
| 344 |
+
)
|
| 345 |
|
| 346 |
# Override CLI hyperparameters if provided
|
| 347 |
if override_learning_rate:
|