Skip to content

Commit

Permalink
changing tmpdir when runnign in slurm
Browse files Browse the repository at this point in the history
  • Loading branch information
adefossez committed Oct 9, 2023
1 parent a2b9675 commit 75426f4
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions audiocraft/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import logging
import multiprocessing
import os
from pathlib import Path
import sys
import typing as tp

Expand Down Expand Up @@ -119,6 +120,11 @@ def init_seed_and_system(cfg):
logger.debug('Setting num threads to %d', cfg.num_threads)
set_efficient_attention_backend(cfg.efficient_attention_backend)
logger.debug('Setting efficient attention backend to %s', cfg.efficient_attention_backend)
if 'SLURM_JOB_ID' in os.environ:
tmpdir = Path('/scratch/slurm_tmpdir/' + os.environ['SLURM_JOB_ID'])
if tmpdir.exists():
logger.info("Changing tmpdir to %s", tmpdir)
os.environ['TMPDIR'] = str(tmpdir)


@hydra_main(config_path='../config', config_name='config', version_base='1.1')
Expand Down

0 comments on commit 75426f4

Please sign in to comment.