Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2024 TODOs #1

Open
8 tasks done
neptunes5thmoon opened this issue Jul 24, 2024 · 8 comments
Open
8 tasks done

2024 TODOs #1

neptunes5thmoon opened this issue Jul 24, 2024 · 8 comments

Comments

@neptunes5thmoon
Copy link
Contributor

neptunes5thmoon commented Jul 24, 2024

  • update instructions for students on how to start notebook in vscode
  • switch data download to s3 bucket
  • conda/mamba
  • pytorch version
  • update U-Net figure
  • Bonus exercise: 3D

BONUS

  • Receptive field size section
  • Translational equivariance section
@neptunes5thmoon
Copy link
Contributor Author

neptunes5thmoon commented Jul 25, 2024

BONUS

  • improve receptive field size plotting function
  • Bonus exercise: translational equivariance on upsample path

@neptunes5thmoon
Copy link
Contributor Author

neptunes5thmoon commented Jul 25, 2024

  • make own version of equivariance figure

@edyoshikun
Copy link

@neptunes5thmoon let us know when this is ready for review

@neptunes5thmoon
Copy link
Contributor Author

it's ready for review, I made all the must have changes ;)
I haven't gotten the tensorboard to work in vscode, so could use some help with that

@AlbertDominguez
Copy link
Contributor

hey @neptunes5thmoon, regarding tensorboard, I've checked it and it looks like is a port forwarding problem, as it is not automatically done when launching the %tensorboard --logdir...
If you manually forward the port from vscode (Ports tab next to the Terminal) and add it to the tensorboard call (so, %tensorboard --logdir abcde --port 6060) and run the cell (or run the cell, checked the assigned port, forward it, and then run the cell again), then it actually displays. That's probably not expected behaviour 🙂

Even then, at least to me, it's not running too smoothly (e.g. not auto-updating the training loss curve), and sometimes you need to run the cell twice even with the port already forwarded for the inline to display.

An alternative is to use the tensorboard extension and have the UI in a different VSCode tab, which you can then put side-by-side with the notebook and is quite convenient as you don't need to scroll up and down and seems to work smoother... but at the same time I think setting it up is more cumbersome compared to the inline version

@edyoshikun
Copy link

Here is my review:

Installation

  • I think the requirement's is missing awscli in requirements.txt. I was running into issues

Tensorboard

For the tensorboard, I had this in the image_translation notebook. Not sure if the instructions.

"""
The next cell starts tensorboard.

<div class="alert alert-warning">
If you launched jupyter lab from ssh terminal, add <code>--host &lt;your-server-name&gt;</code> to the tensorboard command below. <code>&lt;your-server-name&gt;</code> is the address of your compute node that ends in amazonaws.com.

</div>

<div class="alert alert-warning">
If you are using VSCode and a remote server, you will need to forward the port to view the tensorboard. <br>
Take note of the port number was assigned in the previous cell.(i.e <code> http://localhost:{port_number_assigned}</code>) <br>

Locate the your VSCode terminal and select the <code>Ports</code> tab <br>
<ul>
<li>Add a new port with the <code>port_number_assigned</code>
</ul>
Click on the link to view the tensorboard and it should open in your browser.
</div>
"""
# %% Imports and paths tags=[]

# Function to find an available port
def find_free_port():
    import socket

    with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
        s.bind(("", 0))
        return s.getsockname()[1]


# Launch TensorBoard on the browser
def launch_tensorboard(log_dir):
    import subprocess

    port = find_free_port()
    tensorboard_cmd = f"tensorboard --logdir={log_dir} --port={port}"
    process = subprocess.Popen(tensorboard_cmd, shell=True)
    print(
        f"TensorBoard started at http://localhost:{port}. \n"
        "If you are using VSCode remote session, forward the port using the PORTS tab next to TERMINAL."
    )
    return process
# Launch tensorboard and click on the link to view the logs.
tensorboard_process = launch_tensorboard(log_dir)

I had no issues running through the whole notebook. For the last training and displaying with tensorboard, it would be great if we could display all three in one slider that way you can see the input, output, and target at the same time.
I would concat the tb_logger for the input,target and prediction with:

# Concatenate along the width (side by side)
combined_image = torch.cat([x.to("cpu"), y.to("cpu"), prediction.to("cpu").detach()], dim=3)

# Log the combined image to TensorBoard
tb_logger.add_images(
    tag="input_target_prediction", img_tensor=combined_image, global_step=step
)       

Screenshot 2024-08-19 at 9 47 08 AM

After task 3.2

Right after task 3.2, I noticed that apply_and_show_random_image(conv, dataset) usually returns empty frames for the first channel input. Perhaps we can add a comment to ask the person to re-run the cell a couple of times.

I really liked the unet_tests.py!

These are some minor fixes, but overall the notebook looks great! Great job

@neptunes5thmoon
Copy link
Contributor Author

Thanks y'all!

I will work on incorporating your suggestions. My problem with tensorboard was actually that it couldn't find tensorboard on the PATH from vscode so the command wasn't doing anything. I'll report back whether either of your solutions work.

@edyoshikun re: installation - were you running the exercise on the TA machines? When I checked there awscli was pre-installed.

@edyoshikun
Copy link

@neptunes5thmoon I was able to run the tensorboard with vscode with your current implementation. It created the logs in the curr_dir ./. The only other thing I had was the tensorboard extension. Not sure if that makes a difference.

I was testing locally on an HPC node, but if the TA machines have awscli then no need to add.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants