George-API commited on
Commit
a843fab
·
verified ·
1 Parent(s): 678c431

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. run_transformers_training.py +7 -2
run_transformers_training.py CHANGED
@@ -400,8 +400,13 @@ def load_dataset_with_mapping(dataset_config):
400
  record = {}
401
  record["prompt_number"] = dataset[i].get("prompt_number", "N/A")
402
  record["article_id"] = dataset[i].get("article_id", "N/A")
403
- if "conversations" in dataset[i]:
404
- record["conversations_length"] = len(dataset[i]["conversations"])
 
 
 
 
 
405
  sample_records.append(record)
406
 
407
  logger.info(f"Sample records: {sample_records}")
 
400
  record = {}
401
  record["prompt_number"] = dataset[i].get("prompt_number", "N/A")
402
  record["article_id"] = dataset[i].get("article_id", "N/A")
403
+ # Safely get conversations length with None check
404
+ conversations = dataset[i].get("conversations")
405
+ if conversations is not None and isinstance(conversations, list):
406
+ record["conversations_length"] = len(conversations)
407
+ else:
408
+ record["conversations_length"] = 0
409
+ logger.warning(f"Invalid conversations for sample {i}: {type(conversations)}")
410
  sample_records.append(record)
411
 
412
  logger.info(f"Sample records: {sample_records}")