Saving code not working in notebook on some platforms

Hi, I have noticed a different behavior of notebook code saving, depending on the platform.

The code and environment was same in all situations, but on some notebook platforms providing save_code=True as the argument to wandb.init() does not result in saving code. Enabling or disabling code saving through the UI on the website doesn’t affect this behavior. I have also noticed that the “Command” field value can vary depending on the platform.

The code:

! pip install wandb
import wandb
import math
import random

run = wandb.init(project="code_save",
                 config={"hyperparameter": 4},
                 save_code=True)

with run:
    for step in range(100):
        # insert training process here
        wandb.log({
            "acc": math.log(0.1 + random.random() + step * 0.01),
            "val_acc": math.log(0.1 + random.random() + step * 0.01),
            "loss": wandb.config.hyperparameter - math.log(0.1 + random.random() + step * 0.01),
            "val_loss":  wandb.config.hyperparameter - math.log(0.1 + random.random() + step * 0.01)})


wandb.finish()

Here is the info on individual platforms:

VS Code

Command: --ip=127.0.0.1 --stdin=9003 --control=9001 --hb=9000 --Session.signature_scheme=“hmac-sha256” --Session.key=b"ceb312bc-a155-494c-b67d-fe38dc16ee36" --shell=9002 --transport=“tcp” --iopub=9004 --f=/tmp/tmp-5229I8knhn8a7Fqq.json

Code saving not working

Jupyter

Command: test.ipynb

Code saving not working

ipython

Command: test.ipynb

Code saving is working

Google Colab

Command: test.ipynb

Code saving is working

This request was closed and merged into request #65144 “[App]: Enable code saving”.