File size: 587 Bytes
db1e5fb |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
import pathlib
def find_exp_dirs(ignore_repo: bool = False) -> list[str]:
repo_dir = pathlib.Path(__file__).parent
exp_root_dir = repo_dir / 'experiments'
if not exp_root_dir.exists():
return []
exp_dirs = sorted(exp_root_dir.glob('*'))
exp_dirs = [
exp_dir for exp_dir in exp_dirs
if (exp_dir / 'pytorch_lora_weights.bin').exists()
]
if ignore_repo:
exp_dirs = [
exp_dir for exp_dir in exp_dirs if not (exp_dir / '.git').exists()
]
return [path.relative_to(repo_dir).as_posix() for path in exp_dirs]
|