Florent Gbelidji commited on
Commit
83a5c6e
·
verified ·
1 Parent(s): c18c0df

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. llm_ocr/storage.py +5 -20
llm_ocr/storage.py CHANGED
@@ -94,26 +94,11 @@ class HFHubStorage(DatasetStorage):
94
  return bool(self.repo_id)
95
 
96
  def upload_files(self, output_dir: Path, path_prefix: str = "") -> bool:
97
- if not self.is_configured:
98
- LOGGER.debug("HF Hub not configured, skipping file upload")
99
- return False
100
-
101
- try:
102
- from .hf_io import maybe_upload_dataset
103
-
104
- prefix = path_prefix or self.path_in_repo
105
- maybe_upload_dataset(
106
- output_dir=output_dir,
107
- repo_id=self.repo_id,
108
- path_in_repo=prefix,
109
- commit_message=self.commit_message,
110
- revision=self.branch,
111
- )
112
- LOGGER.info("Uploaded files to HF Hub: %s", self.repo_id)
113
- return True
114
- except Exception as exc:
115
- LOGGER.exception("HF Hub file upload failed: %s", exc)
116
- return False
117
 
118
  def save_dataset(self, dataset: "Dataset", name: str) -> bool:
119
  if not self.is_configured:
 
94
  return bool(self.repo_id)
95
 
96
  def upload_files(self, output_dir: Path, path_prefix: str = "") -> bool:
97
+ # For HF Hub, we don't upload raw files separately.
98
+ # The dataset contains embedded images via HfImage, and push_to_hub handles everything.
99
+ # Raw file upload is only needed for S3/GCS backends.
100
+ LOGGER.debug("HF Hub: skipping raw file upload (dataset contains embedded images)")
101
+ return True
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
102
 
103
  def save_dataset(self, dataset: "Dataset", name: str) -> bool:
104
  if not self.is_configured: