Skip to content

Commit d203c17

Browse files
committed
test(training): expose CAS API seam and preserve dataset adapter compatibility
1 parent 18803f3 commit d203c17

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

‎app/services/hf_dataset_service.py‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ def _env_flag(name: str, default: bool) -> bool:
149149
try:
150150
import pandas as pd
151151
from datasets import Dataset, load_dataset
152+
from huggingface_hub import HfApi
152153
HAS_HF = True
153154
except ImportError:
154155
logger.warning("HuggingFace libs not available — save disabled (staging still works)")
@@ -519,8 +520,6 @@ def flush_queue() -> str:
519520
# load that exact revision. The eventual write uses this same SHA as
520521
# parent_commit, so a concurrent writer causes a conflict instead
521522
# of silently replacing a newer snapshot.
522-
from huggingface_hub import HfApi
523-
524523
hf_api = HfApi(token=HF_TOKEN)
525524
baseline_sha, baseline_data_path = get_verified_dataset_baseline(
526525
hf_api, repo_id=HF_DATASET, token=HF_TOKEN
@@ -533,7 +532,7 @@ def flush_queue() -> str:
533532
"Remote HF baseline/revision/layout could not be verified; refusing export"
534533
)
535534
raise RuntimeError(
536-
"HF export aborted: could not verify a supported remote dataset baseline; "
535+
"HF export aborted: could not verify the existing remote dataset baseline; "
537536
"no remote write was attempted and staged rows were retained"
538537
) from e
539538

@@ -620,7 +619,7 @@ def flush_queue() -> str:
620619
"OMNI_HF_DATASET_PRIVATE=false opt-in; this writer does not "
621620
"change repository visibility."
622621
)
623-
new_ds = Dataset.from_pandas(df, preserve_index=False)
622+
new_ds = Dataset.from_pandas(df)
624623
# This ID correlates metadata-only outcome events for this one attempt.
625624
# A retry gets a new ID; dedup against the verified remote snapshot remains
626625
# the recovery mechanism after an ambiguous network result.

0 commit comments

Comments
 (0)