Florent Gbelidji commited on
Sync DeepSeek OCR HF job code
Browse files- ds_batch_ocr/stages.py +3 -5
ds_batch_ocr/stages.py
CHANGED
|
@@ -138,7 +138,7 @@ def _build_dataset_records(documents: Iterable[Dict[str, Any]]) -> List[Dict[str
|
|
| 138 |
|
| 139 |
|
| 140 |
def _push_dataset_records(
|
| 141 |
-
records_files: List[
|
| 142 |
output_dir: Path,
|
| 143 |
repo_id: Optional[str],
|
| 144 |
commit_message: Optional[str],
|
|
@@ -147,8 +147,6 @@ def _push_dataset_records(
|
|
| 147 |
if not repo_id:
|
| 148 |
return
|
| 149 |
|
| 150 |
-
dataset_path = _dataset_path(output_dir)
|
| 151 |
-
|
| 152 |
dataset = load_dataset("json", data_files=records_files, features=_dataset_features())
|
| 153 |
|
| 154 |
token = os.environ.get("HF_TOKEN", None)
|
|
@@ -338,7 +336,7 @@ def run_stage_extract(settings: ExtractSettings) -> None:
|
|
| 338 |
if batch_document_dicts:
|
| 339 |
batch_file = documents_batches_dir / f"batch_{batch_index:05d}.json"
|
| 340 |
write_json(batch_file, batch_document_dicts)
|
| 341 |
-
document_batch_files.append(batch_file)
|
| 342 |
batch_index += 1
|
| 343 |
document_count += len(batch_document_dicts)
|
| 344 |
|
|
@@ -416,7 +414,7 @@ def run_stage_extract(settings: ExtractSettings) -> None:
|
|
| 416 |
"documents": [],
|
| 417 |
"documents_path": documents_batches_dir.name,
|
| 418 |
"documents_batches": [
|
| 419 |
-
file.relative_to(settings.output_dir).as_posix() for file in document_batch_files
|
| 420 |
],
|
| 421 |
"documents_count": document_count,
|
| 422 |
"failures": failures,
|
|
|
|
| 138 |
|
| 139 |
|
| 140 |
def _push_dataset_records(
|
| 141 |
+
records_files: List[str],
|
| 142 |
output_dir: Path,
|
| 143 |
repo_id: Optional[str],
|
| 144 |
commit_message: Optional[str],
|
|
|
|
| 147 |
if not repo_id:
|
| 148 |
return
|
| 149 |
|
|
|
|
|
|
|
| 150 |
dataset = load_dataset("json", data_files=records_files, features=_dataset_features())
|
| 151 |
|
| 152 |
token = os.environ.get("HF_TOKEN", None)
|
|
|
|
| 336 |
if batch_document_dicts:
|
| 337 |
batch_file = documents_batches_dir / f"batch_{batch_index:05d}.json"
|
| 338 |
write_json(batch_file, batch_document_dicts)
|
| 339 |
+
document_batch_files.append(str(batch_file))
|
| 340 |
batch_index += 1
|
| 341 |
document_count += len(batch_document_dicts)
|
| 342 |
|
|
|
|
| 414 |
"documents": [],
|
| 415 |
"documents_path": documents_batches_dir.name,
|
| 416 |
"documents_batches": [
|
| 417 |
+
str(file.relative_to(settings.output_dir).as_posix()) for file in document_batch_files
|
| 418 |
],
|
| 419 |
"documents_count": document_count,
|
| 420 |
"failures": failures,
|