Skip to content

Commit

Permalink
Merge pull request #567 from gordicaleksa/improve_logdir_check_logic
Browse files Browse the repository at this point in the history
Minor fix - better handling of out log dir
  • Loading branch information
karpathy authored Jun 7, 2024
2 parents 5841573 + 40e7289 commit d396cd1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions train_gpt2.cu
Original file line number Diff line number Diff line change
Expand Up @@ -1486,10 +1486,10 @@ int main(int argc, char *argv[]) {
if (output_log_dir != NULL) {
assert(strlen(output_log_dir) < 400); // careful bunch of hardcoded snprintf around this
}
// check if output_log_dir has a "." in it, because this behavior changed May 24, 2024. take out later
if (output_log_dir != NULL && strstr(output_log_dir, ".") != NULL) {
fprintf(stderr, "-o (output_log_dir) has a '.', are you specifying a file instead of dir?\n");
fprintf(stderr, "(note that this option changed recently, -o used to be file, became dir.)\n");
// check if output_log_dir does not exist or is a file
struct stat info;
if (output_log_dir != NULL && (stat(output_log_dir, &info ) != 0 || !(info.st_mode & S_IFDIR))) {
fprintf(stderr, "-o \"%s\" does not exist or is a file - are you specifying a file instead of dir?\n", output_log_dir);
exit(EXIT_FAILURE);
}
int tokens_per_fwdbwd = B * T * multi_gpu_config.num_processes; // one micro-batch processes this many tokens
Expand Down

0 comments on commit d396cd1

Please sign in to comment.