Lesson 8 (2019) discussion & wiki

That’s great. Would you mind sharing these via your GitHub repo?

I wanted to force myself to not “cheat” by looking at Jeremy’s code while re-creating what we did in lesson 8, so I made a notebook with more or less only the instructions. Not sure if it will be helpful to anyone else, but I posted it here

7 Likes

Yes, with a table consisting of 784 columns of continuous variables. You get it by default using fastai.tabular.transform.Normalize.

inject it here maybe: https://forums.fast.ai/t/collaborative-lesson-notes/40387/30

@jeremy, I think there is another buglet to fix in the video.

In broadcasting matmult (video 1:04:25) you suggest that these 2 are the same:

    for i in range(ar):
        c[i] = (a[i].unsqueeze(-1)*b).sum(dim=0)
        c[i] = (a[i,None]*b).sum(dim=0)

but the second one gives an error.

RuntimeError: The size of tensor a (3) must match the size of tensor b (2) at non-singleton dimension 1

The only way I can make it work is via a temp assignment:

    for i in range(ar):
        t = a[i]
        c[i] = (t[:,None]*b).sum(dim=0)

All your unsqueeze using None examples were using : but as soon as you replace : with an actual index like 0, those things no longer work. Here is an example:

m1 = torch.arange(6.0).view(2,3)
m1[0]
m1[0].unsqueeze(-1)
m1[0, None]
tensor([0., 1., 2.])
tensor([[0.],
        [1.],
        [2.]])
tensor([[0., 1., 2.]])

Thanks.

3 Likes

Someone didn’t do their homework :wink: Please see this thread https://forums.fast.ai/t/lesson-8-readings-xavier-and-kaiming-initialization/41715 by @PierreO and his great post https://pouannes.github.io/blog/initialization/ for the details.

3 Likes

Here is my take on the Kaiming He Initialization paper. I have written this Medium post summarizing section 2.2, and understanding it.

Glad I did it since, I definitely needed to refresh some concepts, but it is pretty straightforward, and combining it with the videos you should have a clear idea on what this method does vs. the Xavier/Godot Initialization.

If you see something that is not clear or wrong, just reach out.

PS: Shoutout to @PierreO, saw your post this morning, really nice job man.

5 Likes

Thanks! I’ve created an Errata section in the top post and added this there. Please add any other bugs you notice (except those already mentioned in the video).

2 Likes

Just added a repo link on the notes thread.

2 Likes

Thank you @mkardas for sharing wonderful blog by @PierreO . I was trying but not making much progress on read papers. :slight_smile:

I’m glad I searched before posting the question :slight_smile:
I tried to see if there are ways to achieve this using None but didn’t find one until I saw Jeremy’s post on top (and no matter how long I play with it, it still feels strange).

This also worked:

a[i,...,None]
tensor([[4],
        [5],
        [6]])
3 Likes
a[i,...,None]

Indeed. That would suggest that you may have more than 2 dimensions, so in this case I feel it’d be confusing, since there are only 2.

After experimenting with this, my feeling is that using an explicit unsqueeze is the most intuitive way.

Often you want to write code that can handle varying rank - in which case ... can be used to ensure you don’t have to change anything when rank changes.

2 Likes

its eaiser on the eye compared to unsqueeze so thx

I use Serveo.net (free) to create an SSH tunnel which exposes my Jupyter notebook (port 8888) to the public internet (port 80/443). Caution, security is only as good as the security of Jupyter’s login screen. This command will allow you to access your server’s Jupyter notebook, running on your intra-net, using your own (sub-)domain (e.g. https://n.u.example.com). If ssh crashes, the script will try to reestablish connection once per second. I find it quite reliable. See serveo.net for more info. The beauty of this method is you can access your notebooks anywhere, optionally using your own custom domain. No need to open ports on your router or firewall. An alternative is to use remote access software such as VNC or TeamViewer (free, recommended).

date && until ssh -o ServerAliveInterval=60 -R n.u.example.com:443:localhost:8888 serveo.net -i ~/OneDrive/Documents/u.example.com; do date && sleep 1 && echo "Restarting..."; done
2 Likes

is serveo.net down right now? I get blank page.

I’m working on my serveo.net enabled server without issue although, I concur, their home page is blank but their blog page is working.

Archived home page: https://web.archive.org/web/20190214132821/https://serveo.net

Possible alternatives to serveo.net: https://alternativeto.net/software/serveo

Serveo google group: https://groups.google.com/forum/#!forum/serveo

3 Likes

What’s the benefit over just ssh tunneling? (ssh tunnels are much more secure than this, and don’t require an external service )

In my case, my ISP requires me to pay extra get a static IP.
So instead I can just use this service for the same (free of cost).

But I’m basically using their service just to be able to do ssh tunneling which my current IP won’t allow me to do.

1 Like

Thanks

I found this blog extremely helpful

3 Likes