Wandb does not log all .py files

Hi all,

I’m having an issue with logging code using wandb.run.log_code(“.”). While there are other .py files present in my directory, wandb only seems to log the script that called wandb.init(). This is frustrating, as I want to see all of the code that was used in my run. I’ve even tried stepping through with a debugger, and it looks like wandb is looping over those .py files, but for some reason they aren’t being logged on the run page in the code section.

Has anyone else experienced this issue, or have any suggestions for how to resolve it?

Thanks in advance for any help!

Hi @miladink , happy to help. When calling wandb.run.log_code("."), wandb will capture all python source code files in the current and all sub directories as an artifact. Are you indicating that the generated artifact is not saving all python files when called for the run? Could you please provide a link to your workspace where you are encountering this behavior. Thank you.

Hi @miladink , happy to help. When calling wandb.run.log_code("."), wandb will capture all python source code files in the current and all sub directories as an artifact. Are you indicating that the generated artifact is not saving all python files for the run?

[Discourse post]

Hi @sydholl and @mohammadbakir . I don’t know where to look for an artifact. I look at the “files” tab of a run and I guess all the logged files are there. However, in the code/ section on the files tab, I just see one of my python files which is just the python file that called wandb. However, the other python files that are present in that same directory are not logged. I should note I call wandb.run.log_code(".") from that script. Am I doing something wrong?

Hi @miladink , apologies for the delay. To access the artifacts page, select the DB icon as in this example here. Could you try the following:

wandb.run.log_code(".", include_fn=lambda path: path.endswith(".py")).

If it doesn’t work, please provide:

  • Screen shot of your working directory
  • Link to your workspace
  • Example code of how you are using log_code()

Thanks

Hi @miladink since we have not heard back from you we are going to close this request. If you would like to re-open the conversation, please let us know!