Skip to content

Commit 7426cc5

Browse files
committed
fix default output model name length
1 parent b103d2f commit 7426cc5

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

eval_protocol/cli_commands/create_rft.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -702,8 +702,13 @@ def _create_rft_job(
702702
print(f"Prepared RFT job for evaluator '{evaluator_id}' using dataset '{dataset_id}'")
703703
if getattr(args, "evaluation_dataset", None):
704704
body["evaluationDataset"] = args.evaluation_dataset
705-
if getattr(args, "output_model", None):
706-
body.setdefault("trainingConfig", {})["outputModel"] = f"accounts/{account_id}/models/{args.output_model}"
705+
706+
output_model_arg = getattr(args, "output_model", None)
707+
if output_model_arg:
708+
if len(output_model_arg) > 63:
709+
print(f"Error: Output model name '{output_model_arg}' exceeds 63 characters.")
710+
return 1
711+
body.setdefault("trainingConfig", {})["outputModel"] = f"accounts/{account_id}/models/{output_model_arg}"
707712
else:
708713
# Auto-generate output model name if not provided
709714
auto_output_model = build_default_output_model(evaluator_id)

eval_protocol/fireworks_rft.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import tempfile
77
import time
88
import uuid
9+
import hashlib
910
from pathlib import Path
1011
from typing import Any, Callable, Dict, Iterable, Optional, Tuple
1112
from urllib.parse import urlencode
@@ -216,6 +217,24 @@ def build_default_dataset_id(evaluator_id: str) -> str:
216217
def build_default_output_model(evaluator_id: str) -> str:
217218
base = evaluator_id.lower().replace("_", "-")
218219
uuid_suffix = str(uuid.uuid4())[:4]
220+
221+
# suffix is "-rft-{4chars}" -> 9 chars
222+
suffix_len = 9
223+
max_len = 63
224+
225+
# Check if we need to truncate
226+
if len(base) + suffix_len > max_len:
227+
# Calculate hash of the full base to preserve uniqueness
228+
hash_digest = hashlib.sha256(base.encode("utf-8")).hexdigest()[:6]
229+
# New structure: {truncated_base}-{hash}-{uuid_suffix}
230+
# Space needed for "-{hash}" is 1 + 6 = 7
231+
hash_part_len = 7
232+
233+
allowed_base_len = max_len - suffix_len - hash_part_len
234+
truncated_base = base[:allowed_base_len].strip("-")
235+
236+
return f"{truncated_base}-{hash_digest}-rft-{uuid_suffix}"
237+
219238
return f"{base}-rft-{uuid_suffix}"
220239

221240

0 commit comments

Comments
 (0)