Skip to content

Conversation

@felipemello1
Copy link
Contributor

Context

What is the purpose of this PR? Is it to

  • add a new feature
  • fix a bug
  • update tests and/or documentation
  • other (please add here)

if log_dir was not passed ,it would crash. This makes log_dir optonal

Test plan

tune run full_finetune_single_device --config llama3_2/1B_full_single_device dataset.packed=True tokenizer.max_seq_len=512 dataset.split=train[:5%] metric_logger=torchtune.training.metric_logging.WandBLogger ~metric_logger.log_dir

Before this change:

TypeError: stat: path should be string, bytes, os.PathLike or integer, not NoneType

After this change:
It works!

@pytorch-bot
Copy link

pytorch-bot bot commented Feb 12, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/torchtune/2389

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit a679bc4 with merge base d5d85c5 (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Feb 12, 2025

# create log_dir if missing
if not os.path.exists(self.log_dir):
if self.log_dir and not os.path.exists(self.log_dir):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is not None

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A new test would be nice ...

Copy link
Contributor Author

@felipemello1 felipemello1 Feb 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if self.log_dir works, no? Did you suggest "is not None" for readability or something else?

boooo for the test

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there's a possibility it can be None, then the proper check is if x is not None

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with filing a follow up for test :)

Copy link
Member

@joecummings joecummings left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stampy stamp

@felipemello1 felipemello1 merged commit 0792bcf into meta-pytorch:main Feb 12, 2025
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants