tfrere commited on
Commit
47f7bc8
·
1 Parent(s): 79407fd

always print benchmark question 2 and 3

Browse files
Files changed (1) hide show
  1. backend/routes/questions.py +10 -6
backend/routes/questions.py CHANGED
@@ -35,9 +35,11 @@ async def get_benchmark_questions(session_id: str):
35
  # Essayer de charger les questions single-shot directement avec le nom de config
36
  single_dataset = load_dataset(dataset_repo_id, 'single_shot_questions')
37
  if single_dataset and len(single_dataset['train']) > 0:
38
- # Get a random sample (up to 2) from single-shot questions
39
- sample_indices = random.sample(range(len(single_dataset['train'])), min(2, len(single_dataset['train'])))
40
- for idx in sample_indices:
 
 
41
  questions.append({
42
  "id": str(idx),
43
  "question": single_dataset['train'][idx].get("question", ""),
@@ -53,10 +55,12 @@ async def get_benchmark_questions(session_id: str):
53
  if len(questions) < 2:
54
  multi_dataset = load_dataset(dataset_repo_id, 'multi_hop_questions')
55
  if multi_dataset and len(multi_dataset['train']) > 0:
56
- # Get remaining questions from multi-hop questions
 
57
  remaining = 2 - len(questions)
58
- sample_indices = random.sample(range(len(multi_dataset['train'])), min(remaining, len(multi_dataset['train'])))
59
- for idx in sample_indices:
 
60
  questions.append({
61
  "id": str(idx),
62
  "question": multi_dataset['train'][idx].get("question", ""),
 
35
  # Essayer de charger les questions single-shot directement avec le nom de config
36
  single_dataset = load_dataset(dataset_repo_id, 'single_shot_questions')
37
  if single_dataset and len(single_dataset['train']) > 0:
38
+ # Prendre 2 questions à partir de l'index 1 (en évitant la première question)
39
+ start_idx = 1
40
+ max_questions = min(2, max(0, len(single_dataset['train']) - start_idx))
41
+ for i in range(max_questions):
42
+ idx = start_idx + i
43
  questions.append({
44
  "id": str(idx),
45
  "question": single_dataset['train'][idx].get("question", ""),
 
55
  if len(questions) < 2:
56
  multi_dataset = load_dataset(dataset_repo_id, 'multi_hop_questions')
57
  if multi_dataset and len(multi_dataset['train']) > 0:
58
+ # Prendre les questions multi-hop pour compléter, en évitant aussi la première
59
+ start_idx = 1
60
  remaining = 2 - len(questions)
61
+ max_questions = min(remaining, max(0, len(multi_dataset['train']) - start_idx))
62
+ for i in range(max_questions):
63
+ idx = start_idx + i
64
  questions.append({
65
  "id": str(idx),
66
  "question": multi_dataset['train'][idx].get("question", ""),