davanstrien HF Staff commited on
Commit
fedc701
·
verified ·
1 Parent(s): 3d2c5a0

Upload classify_arxiv_to_lance.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. classify_arxiv_to_lance.py +3 -2
classify_arxiv_to_lance.py CHANGED
@@ -234,7 +234,8 @@ def prepare_incremental_data(
234
 
235
  # Select only the columns we need (drop nested columns that cause issues)
236
  columns_to_keep = ["id", "title", "abstract", "categories", "update_date", "authors"]
237
- lf_selected = lf_cs.select([col for col in columns_to_keep if col in lf_cs.columns])
 
238
 
239
  # Add formatted text column for classification
240
  logger.info("Formatting text for classification...")
@@ -251,7 +252,7 @@ def prepare_incremental_data(
251
 
252
  # Collect the data
253
  logger.info("Collecting data...")
254
- df = lf_formatted.collect(streaming=True)
255
 
256
  if df.height == 0:
257
  logger.info("No papers to classify")
 
234
 
235
  # Select only the columns we need (drop nested columns that cause issues)
236
  columns_to_keep = ["id", "title", "abstract", "categories", "update_date", "authors"]
237
+ available_columns = lf_cs.collect_schema().names()
238
+ lf_selected = lf_cs.select([col for col in columns_to_keep if col in available_columns])
239
 
240
  # Add formatted text column for classification
241
  logger.info("Formatting text for classification...")
 
252
 
253
  # Collect the data
254
  logger.info("Collecting data...")
255
+ df = lf_formatted.collect(engine="streaming")
256
 
257
  if df.height == 0:
258
  logger.info("No papers to classify")