Skip to content

Commit d272c80

Browse files
Merge pull request #88 from bcrochet/ignore-knowledge
fix: mt_bench_branch should ignore knowledge in generate
2 parents 4c020b6 + 3147c75 commit d272c80

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

src/instructlab/eval/mt_bench_branch_generator.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# SPDX-License-Identifier: Apache-2.0
22
# Standard
3+
from pathlib import Path
34
import hashlib
45
import json
56
import os
@@ -22,10 +23,20 @@
2223
def get_file_paths(directory):
2324
logger.debug(locals())
2425
file_paths = []
25-
for root, _, files in os.walk(directory):
26-
for file in files:
27-
if file.split("/")[-1] == "qna.yaml":
28-
file_paths.append(os.path.join(root, file))
26+
root_paths = [
27+
entry
28+
for entry in Path(directory).iterdir()
29+
if entry.is_dir()
30+
if not entry.name.startswith(".")
31+
if entry.name != "knowledge"
32+
if entry.name != "docs"
33+
if entry.name != "scripts"
34+
]
35+
for basedir in root_paths:
36+
for root, _, files in os.walk(basedir):
37+
file_paths.extend(
38+
[os.path.join(root, file) for file in files if file == "qna.yaml"]
39+
)
2940
return file_paths
3041

3142

0 commit comments

Comments
 (0)