Host VS Code in the browser on Google Cloud with accelerated machine learning capabilities via a Tensor Processing Unit (TPU). Coder makes it possible to access your IDE from any device without sacrificing features.  https://github.com/codercom/code-server 

- Full lesson https://fireship.io
- Coder https://coder.com/
- TPU https://cloud.google.com/tpu/

#vscode #gcp #tensorflow
2024-02-04T06:52:11.397Z
nova-2
2-general-nova
2024-01-09.29447
30089e05-99d1-4376-b32e-c263170674af
2dad822c-bf65-4947-a24d-7d515c73df8c
c96aded7e2514d2688a140ec72edb1ba5a4bf2091ba6b4df8b94044a8fc3b98e
67875a7f-c9c4-48a0-aa55-5bdb8a91c34a
deprecated
The beauty of Versus Code is that it starts out minimal, but allows you to customize it into a full blown integrated development environment.
I really like the Atom 1 dark syntax theme, Versus Code icons.
I have a bunch of custom workspace settings and extensions that I just couldn't live without.
But the problem is that all these customizations are tied to my local machine.
But fortunately, a company called Coder just recently open sourced a project called CodeServer that allows you to run Versus Code in the cloud.
In today's video, I'll show you how to run your own instance of CodeServer on Google Cloud Platform, and will supercharge it with a tensor processing unit, which will give it access to a massive amount of computing resources for machine learning.
If you're new here, like and subscribe, and you can find a step by step breakdown of this video on Fireship IO.
Let's start by taking a look at Coder.
This is a startup that has in Versus Code and made it available in the browser.
This allows you to access your IDE with all of its settings from any machine, even a cell phone or tablet if you wanted It also allows multiple developers to collaborate on the same project from the same editor.
And because you can self host it, you can attach an unlimited amount of computing resources to its back end.
The easiest way to get started is to just log into Coder, and it will immediately bring you to this instance of Versus Code.
And the awesome thing about this is that it feels just like the Versus Code on your desktop.
So the first thing I'll do is go to the extensions and then install the atom 1 dark theme.
Much better.
And if we open a terminal session, you can see that we have access to the the actual virtual machine that's running this container.
It doesn't come with Node JS installed by default, so I'm going to the node version manager repo and grabbing the install command.
That installs Node version manager on the container, then we can use NVM to install Node itself.
At this point, we could install Angular or React and start doing front end development from this virtual environment.
When developing in the browser, you might notice a small amount of lag when saving files because that has to happen remotely.
But when you're actually writing code, it should feel just like you're working in the desktop version of s code.
Now Coder gives us a couple gigabytes of memory and storage space, but there's a good chance you'll want to go beyond these limits by hosting your own instance in the cloud, which You can do on AWS, GCP, Azure, or wherever you want.
We'll set up ours on Google Cloud, and I want to show you how to set it up for both front end development and also for machine learning, specifically with TensorFlow.
Start by going to the GCP console and find the Compute Engine tab.
We'll create our own virtual machine with some customized settings.
Keep in mind this will accrue cost on GCP, so make sure to shut it down when you're done using it.
And everything is built to the second, so you only have to have your virtual machine running when you're actually using Versus Code in the cloud.
The smallest possible instance is about $4 per month, but but that's probably not going to be quite enough to run Versus Code comfortably.
It's recommended to start with a standard instance with 2 CPU cores and 7.5 gigabytes of memory.
That'll cost you about 6¢ per hour to run or about $49 per month if you just leave it running continuously.
I'm just going to go with the recommended 2 CPU cores here, and then we're going to set the operating system to Ubuntu 16.04.
We're going to be accessing it on the web, so we'll make sure to allow HTTP and HTTPS traffic.
Go ahead and click create, and then you should see a green check mark when it's ready.
The next thing we wanna do is install code server, which is the open source project that powers Coder.
In order to do that, we need to get access to the command line of this virtual machine as the administrator.
You'll see this SSH button next to your VM.
If If you click that, it'll give you several different options for starting a terminal session.
The easiest option is to just run-in Cloud Shell, which will bring up a command line in the browser window.
From there, we'll go back to GitHub to find the download link for the latest release of code server on Linux.
Next, we'll use the w git command, which gets things from the web on Linux along with this download URL.
That will download code server to the actual file system on this virtual machine.
When that's done, we'll go ahead and unzip it using the tar command.
Then we can CD into the unzip directory, and that contains the actual binary that will run Versus Code in the browser.
We'll prefix Fix the command with sudo and then point to the code server binary and then add flag p to run it on port 80.
That should tell you that it's running on local host Eighty and then notice the password in the middle.
You'll wanna make sure to copy that, and then you can link directly to your external IP from the GCP console.
From there, you'll want to add port 80 to the end of that IP, and it'll give you a warning that this connection is not private.
You can ignore that warning by going down to advanced and then proceed to the IP URL.
From there, it's going to ask you for a password to access the IDE, copy and paste that in from the terminal output, and we now have our own version of Versus Code running on GCP.
It's going to look and feel exactly like the demo that we looked at earlier on coder.com, but now we have full control over the underlying compute resources.
I've already gone ahead and installed my preferred themes and also Node and Angular.
I'm going to generate a new Angular app and then try to serve it on this local machine.
Angular serves on port 42100 by default.
And if we try to go to port 42100 on this IP address, you can see that the connection is refused.
That's because VMs on Google have a firewall implemented by default.
If you're doing front end development, you'll probably want to adjust the settings of the firewall, which you can do by going to the network details for this VM.
There's a few different ways you can do this.
For example, you can just change the default rule to allow a higher range of ports, but you have fine grain control over how the firewall works.
So if you want to create your own firewall rule, you can do one that Typically allows port 42100 for Angular.
I'm setting mine up for the more general port of 8080, and we just check the box for TCP and allow traffic to that port.
It's also important to give it a tag because you can use that tag to apply it to specific VMs.
If we go ahead and save this rule and then go back to our VM details, You'll see an option for network tags.
Just enter the tag that you use for your firewall rule, and then you should be good to go to allow traffic to the specified port.
If we go back to that port on the IP address, we should be able to refresh it and see our Angular app being served there now.
So that's how you get started with front end development with Coder.
What I really wanna show you is how to wire that Versus Code with some of the most advanced computing hardware out there.
A tensor processing unit or TPU is It's a piece of hardware designed for large scale machine learning problems.
They're used to train AI models for things like Gmail, Google Search, Google Translate, and they just recently became available to the public.
If you're looking to get into deep learning, a TPU is a lot more cost effective and a lot more powerful than a typical NVIDIA GPU graphics card.
Let's start by going to the TPU's tab on Compute Engine.
TPU's are not cheap.
You'll definitely wanna make sure you delete this when you're done using it.
Otherwise, you'll be looking at about $3,000 per month or 4:50 per hour, but that's actually very reasonable considering how much computing power is behind these things.
You can create your TPU from the console, but I actually find it easier to do from the command line.
So we'll open up a new session here, and then we'll run c TPU up.
And this is going to create a TPU node as well as a virtual machine that we can use to interact with that node and run code.
It will also install TensorFlow in that VM, so it takes care of some of the setup for us.
You'll notice another VM running in the VM instance list.
This one's not going to have code server installed, so you'll need to go through the exact same process that we went through earlier.
I'm not going to cover it in this video, but if you're spinning up multiple instances with Coder installed, you'll definitely want to save a disk image that you can reuse or a Docker container.
TensorFlow is a Python library, and I already have it installed on both of my virtual machines.
I'm not going to cover the basics of machine learning here, but mostly wanna show you the performance difference from a CPU to a TPU.
And we'll do that by creating a problem here that uses a neural network to process a lot of synthetic or fake data.
The first thing we'll do is create a data size of 2 to the 18th power, and then we'll use linspace to create an array with an interval of values based on that size.
Then Then we'll go ahead and randomly shuffle that array, and then we'll format this data so that it randomly follows the shape of a sine wave.
So each Each point will be an x y value and then we'll set up our neural network to try to predict the y value of this dataset.
So this is what the dataset looks like visually.
You can see there's some random noise in here and the neural network will try to fit a line that best generalizes this data.
The next thing I'm doing is separating this data into a training set and a testing set by simply slicing the array.
Then we'll define a function called get model that uses Keras to create a basic neural network.
It starts with an input layer that just takes our array, and and then we'll split that into a layer with 200 nodes and then another layer with 80 nodes, and then we'll output our final prediction which should be the y value.
Given the size of our dataset, this model should take a very long time to train.
The next thing we'll do is compile the model.
We'll give it a standard gradient descent optimizer, and then we'll be optimizing for the mean squared error.
Currently, I'm writing this code on our initial VM that just has the 2 CPU cores.
It's running roughly one step in the epic per second.
There are a total of 10 epics and 512 steps each, which means it should take about 90 minutes to finish the training on this network.
That's not too bad in the machine learning world, but let's see how much faster this would be on a TPU.
I'm switching over to the other VM that's associated with the TPU, and then I'm adding some extra code here that will Hook up our existing model with the TPU.
TensorFlow has a variety of different ways it can distribute data.
In this case, we'll use the TPU distribution strategy.
And will fit the model using the same parameters that we had before.
And right away, you'll see a huge difference in performance.
Each epic only takes about 15 seconds now.
So So it takes about 90 minutes on a CPU, only takes about 2.5 minutes in a TPU.
But what's really awesome about all this is that we now have Says to the best development tools like Versus Code in the cloud while being able to scale up its computing resources based on the demands of the project or the size of the team.
Software is starting to become just as good in the browser, if not better than it is installed on your local machine.
Coder is a perfect example of that and something you'll definitely wanna check out.
I'm gonna go ahead and wrap things up there.
If this video helped you, please like and subscribe.
And let me know what you wanna see next in the comments.
Thanks for watching, and I will talk to you soon.

Speaker 0: The beauty of Versus Code is that it starts out minimal, but allows you to customize it into a full blown integrated development environment. I really like the Atom 1 dark syntax theme, Versus Code icons. I have a bunch of custom workspace settings and extensions that I just couldn't live without. But the problem is that all these customizations are tied to my local machine. But fortunately, a company called Coder just recently open sourced a project called CodeServer that allows you to run Versus Code in the cloud.

In today's video, I'll show you how to run your own instance of CodeServer on Google Cloud Platform, and will supercharge it with a tensor processing unit, which will give it access to a massive amount of computing resources for machine learning. If you're new here, like and subscribe, and you can find a step by step breakdown of this video on Fireship IO. Let's start by taking a look at Coder. This is a startup that has in Versus Code and made it available in the browser. This allows you to access your IDE with all of its settings from any machine, even a cell phone or tablet if you wanted It also allows multiple developers to collaborate on the same project from the same editor.

And because you can self host it, you can attach an unlimited amount of computing resources to its back end. The easiest way to get started is to just log into Coder, and it will immediately bring you to this instance of Versus Code. And the awesome thing about this is that it feels just like the Versus Code on your desktop. So the first thing I'll do is go to the extensions and then install the atom 1 dark theme. Much better.

And if we open a terminal session, you can see that we have access to the the actual virtual machine that's running this container. It doesn't come with Node JS installed by default, so I'm going to the node version manager repo and grabbing the install command. That installs Node version manager on the container, then we can use NVM to install Node itself. At this point, we could install Angular or React and start doing front end development from this virtual environment. When developing in the browser, you might notice a small amount of lag when saving files because that has to happen remotely.

But when you're actually writing code, it should feel just like you're working in the desktop version of s code. Now Coder gives us a couple gigabytes of memory and storage space, but there's a good chance you'll want to go beyond these limits by hosting your own instance in the cloud, which You can do on AWS, GCP, Azure, or wherever you want. We'll set up ours on Google Cloud, and I want to show you how to set it up for both front end development and also for machine learning, specifically with TensorFlow. Start by going to the GCP console and find the Compute Engine tab. We'll create our own virtual machine with some customized settings.

Keep in mind this will accrue cost on GCP, so make sure to shut it down when you're done using it. And everything is built to the second, so you only have to have your virtual machine running when you're actually using Versus Code in the cloud. The smallest possible instance is about $4 per month, but but that's probably not going to be quite enough to run Versus Code comfortably. It's recommended to start with a standard instance with 2 CPU cores and 7.5 gigabytes of memory. That'll cost you about 6¢ per hour to run or about $49 per month if you just leave it running continuously.

I'm just going to go with the recommended 2 CPU cores here, and then we're going to set the operating system to Ubuntu 16.04. We're going to be accessing it on the web, so we'll make sure to allow HTTP and HTTPS traffic. Go ahead and click create, and then you should see a green check mark when it's ready. The next thing we wanna do is install code server, which is the open source project that powers Coder. In order to do that, we need to get access to the command line of this virtual machine as the administrator.

You'll see this SSH button next to your VM. If If you click that, it'll give you several different options for starting a terminal session. The easiest option is to just run-in Cloud Shell, which will bring up a command line in the browser window. From there, we'll go back to GitHub to find the download link for the latest release of code server on Linux. Next, we'll use the w git command, which gets things from the web on Linux along with this download URL.

That will download code server to the actual file system on this virtual machine. When that's done, we'll go ahead and unzip it using the tar command. Then we can CD into the unzip directory, and that contains the actual binary that will run Versus Code in the browser. We'll prefix Fix the command with sudo and then point to the code server binary and then add flag p to run it on port 80. That should tell you that it's running on local host Eighty and then notice the password in the middle.

You'll wanna make sure to copy that, and then you can link directly to your external IP from the GCP console. From there, you'll want to add port 80 to the end of that IP, and it'll give you a warning that this connection is not private. You can ignore that warning by going down to advanced and then proceed to the IP URL. From there, it's going to ask you for a password to access the IDE, copy and paste that in from the terminal output, and we now have our own version of Versus Code running on GCP. It's going to look and feel exactly like the demo that we looked at earlier on coder.com, but now we have full control over the underlying compute resources.

I've already gone ahead and installed my preferred themes and also Node and Angular. I'm going to generate a new Angular app and then try to serve it on this local machine. Angular serves on port 42100 by default. And if we try to go to port 42100 on this IP address, you can see that the connection is refused. That's because VMs on Google have a firewall implemented by default.

If you're doing front end development, you'll probably want to adjust the settings of the firewall, which you can do by going to the network details for this VM. There's a few different ways you can do this. For example, you can just change the default rule to allow a higher range of ports, but you have fine grain control over how the firewall works. So if you want to create your own firewall rule, you can do one that Typically allows port 42100 for Angular. I'm setting mine up for the more general port of 8080, and we just check the box for TCP and allow traffic to that port.

It's also important to give it a tag because you can use that tag to apply it to specific VMs. If we go ahead and save this rule and then go back to our VM details, You'll see an option for network tags. Just enter the tag that you use for your firewall rule, and then you should be good to go to allow traffic to the specified port. If we go back to that port on the IP address, we should be able to refresh it and see our Angular app being served there now. So that's how you get started with front end development with Coder.

What I really wanna show you is how to wire that Versus Code with some of the most advanced computing hardware out there. A tensor processing unit or TPU is It's a piece of hardware designed for large scale machine learning problems. They're used to train AI models for things like Gmail, Google Search, Google Translate, and they just recently became available to the public. If you're looking to get into deep learning, a TPU is a lot more cost effective and a lot more powerful than a typical NVIDIA GPU graphics card. Let's start by going to the TPU's tab on Compute Engine.

TPU's are not cheap. You'll definitely wanna make sure you delete this when you're done using it. Otherwise, you'll be looking at about $3,000 per month or 4:50 per hour, but that's actually very reasonable considering how much computing power is behind these things. You can create your TPU from the console, but I actually find it easier to do from the command line. So we'll open up a new session here, and then we'll run c TPU up.

And this is going to create a TPU node as well as a virtual machine that we can use to interact with that node and run code. It will also install TensorFlow in that VM, so it takes care of some of the setup for us. You'll notice another VM running in the VM instance list. This one's not going to have code server installed, so you'll need to go through the exact same process that we went through earlier. I'm not going to cover it in this video, but if you're spinning up multiple instances with Coder installed, you'll definitely want to save a disk image that you can reuse or a Docker container.

TensorFlow is a Python library, and I already have it installed on both of my virtual machines. I'm not going to cover the basics of machine learning here, but mostly wanna show you the performance difference from a CPU to a TPU. And we'll do that by creating a problem here that uses a neural network to process a lot of synthetic or fake data. The first thing we'll do is create a data size of 2 to the 18th power, and then we'll use linspace to create an array with an interval of values based on that size. Then Then we'll go ahead and randomly shuffle that array, and then we'll format this data so that it randomly follows the shape of a sine wave.

So each Each point will be an x y value and then we'll set up our neural network to try to predict the y value of this dataset. So this is what the dataset looks like visually. You can see there's some random noise in here and the neural network will try to fit a line that best generalizes this data. The next thing I'm doing is separating this data into a training set and a testing set by simply slicing the array. Then we'll define a function called get model that uses Keras to create a basic neural network.

It starts with an input layer that just takes our array, and and then we'll split that into a layer with 200 nodes and then another layer with 80 nodes, and then we'll output our final prediction which should be the y value. Given the size of our dataset, this model should take a very long time to train. The next thing we'll do is compile the model. We'll give it a standard gradient descent optimizer, and then we'll be optimizing for the mean squared error. Currently, I'm writing this code on our initial VM that just has the 2 CPU cores.

It's running roughly one step in the epic per second. There are a total of 10 epics and 512 steps each, which means it should take about 90 minutes to finish the training on this network. That's not too bad in the machine learning world, but let's see how much faster this would be on a TPU. I'm switching over to the other VM that's associated with the TPU, and then I'm adding some extra code here that will Hook up our existing model with the TPU. TensorFlow has a variety of different ways it can distribute data.

In this case, we'll use the TPU distribution strategy. And will fit the model using the same parameters that we had before. And right away, you'll see a huge difference in performance. Each epic only takes about 15 seconds now. So So it takes about 90 minutes on a CPU, only takes about 2.5 minutes in a TPU.

But what's really awesome about all this is that we now have Says to the best development tools like Versus Code in the cloud while being able to scale up its computing resources based on the demands of the project or the size of the team. Software is starting to become just as good in the browser, if not better than it is installed on your local machine. Coder is a perfect example of that and something you'll definitely wanna check out. I'm gonna go ahead and wrap things up there. If this video helped you, please like and subscribe.

And let me know what you wanna see next in the comments. Thanks for watching, and I will talk to you soon.
The beauty of Versus Code is that it starts out minimal, but allows you to customize it into a full blown integrated development environment. I really like the Atom 1 dark syntax theme, Versus Code icons. I have a bunch of custom workspace settings and extensions that I just couldn't live without.
architecture
software development
But the problem is that all these customizations are tied to my local machine. But fortunately, a company called Coder just recently open sourced a project called CodeServer that allows you to run Versus Code in the cloud. In today's video, I'll show you how to run your own instance of CodeServer on Google Cloud Platform, and will supercharge it with a tensor processing unit, which will give it access to a massive amount of computing resources for machine learning.
If you're new here, like and subscribe, and you can find a step by step breakdown of this video on Fireship IO. Let's start by taking a look at Coder. This is a startup that has in Versus Code and made it available in the browser. This allows you to access your IDE with all of its settings from any machine, even a cell phone or tablet if you wanted It also allows multiple developers to collaborate on the same project from the same editor. And because you can self host it, you can attach an unlimited amount of computing resources to its back end. The easiest way to get started is to just log into Coder, and it will immediately bring you to this instance of Versus Code. And the awesome thing about this is that it feels just like the Versus Code on your desktop.
video gaming
networking
software
software development
streaming
programming
youtube
technology
internet
So the first thing I'll do is go to the extensions and then install the atom 1 dark theme. Much better. And if we open a terminal session, you can see that we have access to the the actual virtual machine that's running this container. It doesn't come with Node JS installed by default, so I'm going to the node version manager repo and grabbing the install command. That installs Node version manager on the container, then we can use NVM to install Node itself. At this point, we could install Angular or React and start doing front end development from this virtual environment. When developing in the browser, you might notice a small amount of lag when saving files because that has to happen remotely. But when you're actually writing code, it should feel just like you're working in the desktop version of s code. Now Coder gives us a couple gigabytes of memory and storage space, but there's a good chance you'll want to go beyond these limits by hosting your own instance in the cloud, which You can do on AWS, GCP, Azure, or wherever you want. We'll set up ours on Google Cloud, and I want to show you how to set it up for both front end development and also for machine learning, specifically with TensorFlow. Start by going to the GCP console and find the Compute Engine tab. We'll create our own virtual machine with some customized settings. Keep in mind this will accrue cost on GCP, so make sure to shut it down when you're done using it. And everything is built to the second, so you only have to have your virtual machine running when you're actually using Versus Code in the cloud. The smallest possible instance is about $4 per month, but but that's probably not going to be quite enough to run Versus Code comfortably. It's recommended to start with a standard instance with 2 CPU cores and 7.5 gigabytes of memory. That'll cost you about 6¢ per hour to run or about $49 per month if you just leave it running continuously. I'm just going to go with the recommended 2 CPU cores here, and then we're going to set the operating system to Ubuntu 16.04.
We're going to be accessing it on the web, so we'll make sure to allow HTTP and HTTPS traffic. Go ahead and click create, and then you should see a green check mark when it's ready. The next thing we wanna do is install code server, which is the open source project that powers Coder.
internet
infrastructure
In order to do that, we need to get access to the command line of this virtual machine as the administrator. You'll see this SSH button next to your VM. If If you click that, it'll give you several different options for starting a terminal session.
The easiest option is to just run-in Cloud Shell, which will bring up a command line in the browser window. From there, we'll go back to GitHub to find the download link for the latest release of code server on Linux. Next, we'll use the w git command, which gets things from the web on Linux along with this download URL. That will download code server to the actual file system on this virtual machine. When that's done, we'll go ahead and unzip it using the tar command. Then we can CD into the unzip directory, and that contains the actual binary that will run Versus Code in the browser.
software
We'll prefix Fix the command with sudo and then point to the code server binary and then add flag p to run it on port 80. That should tell you that it's running on local host Eighty and then notice the password in the middle. You'll wanna make sure to copy that, and then you can link directly to your external IP from the GCP console. From there, you'll want to add port 80 to the end of that IP, and it'll give you a warning that this connection is not private. You can ignore that warning by going down to advanced and then proceed to the IP URL. From there, it's going to ask you for a password to access the IDE, copy and paste that in from the terminal output, and we now have our own version of Versus Code running on GCP. It's going to look and feel exactly like the demo that we looked at earlier on coder.com, but now we have full control over the underlying compute resources. I've already gone ahead and installed my preferred themes and also Node and Angular. I'm going to generate a new Angular app and then try to serve it on this local machine. Angular serves on port 42100 by default. And if we try to go to port 42100 on this IP address, you can see that the connection is refused. That's because VMs on Google have a firewall implemented by default. If you're doing front end development, you'll probably want to adjust the settings of the firewall, which you can do by going to the network details for this VM. There's a few different ways you can do this. For example, you can just change the default rule to allow a higher range of ports, but you have fine grain control over how the firewall works. So if you want to create your own firewall rule, you can do one that Typically allows port 42100 for Angular. I'm setting mine up for the more general port of 8080, and we just check the box for TCP and allow traffic to that port. It's also important to give it a tag because you can use that tag to apply it to specific VMs. If we go ahead and save this rule and then go back to our VM details, You'll see an option for network tags. Just enter the tag that you use for your firewall rule, and then you should be good to go to allow traffic to the specified port. If we go back to that port on the IP address, we should be able to refresh it and see our Angular app being served there now.
So that's how you get started with front end development with Coder. What I really wanna show you is how to wire that Versus Code with some of the most advanced computing hardware out there. A tensor processing unit or TPU is It's a piece of hardware designed for large scale machine learning problems. They're used to train AI models for things like Gmail, Google Search, Google Translate, and they just recently became available to the public. If you're looking to get into deep learning, a TPU is a lot more cost effective and a lot more powerful than a typical NVIDIA GPU graphics card.
neural networks
programming
machine learning
Let's start by going to the TPU's tab on Compute Engine. TPU's are not cheap. You'll definitely wanna make sure you delete this when you're done using it. Otherwise, you'll be looking at about $3,000 per month or 4:50 per hour, but that's actually very reasonable considering how much computing power is behind these things. You can create your TPU from the console, but I actually find it easier to do from the command line. So we'll open up a new session here, and then we'll run c TPU up. And this is going to create a TPU node as well as a virtual machine that we can use to interact with that node and run code. It will also install TensorFlow in that VM, so it takes care of some of the setup for us. You'll notice another VM running in the VM instance list.
This one's not going to have code server installed, so you'll need to go through the exact same process that we went through earlier. I'm not going to cover it in this video, but if you're spinning up multiple instances with Coder installed, you'll definitely want to save a disk image that you can reuse or a Docker container. TensorFlow is a Python library, and I already have it installed on both of my virtual machines. I'm not going to cover the basics of machine learning here, but mostly wanna show you the performance difference from a CPU to a TPU. And we'll do that by creating a problem here that uses a neural network to process a lot of synthetic or fake data. The first thing we'll do is create a data size of 2 to the 18th power, and then we'll use linspace to create an array with an interval of values based on that size. Then Then we'll go ahead and randomly shuffle that array, and then we'll format this data so that it randomly follows the shape of a sine wave. So each Each point will be an x y value and then we'll set up our neural network to try to predict the y value of this dataset. So this is what the dataset looks like visually. You can see there's some random noise in here and the neural network will try to fit a line that best generalizes this data. The next thing I'm doing is separating this data into a training set and a testing set by simply slicing the array. Then we'll define a function called get model that uses Keras to create a basic neural network. It starts with an input layer that just takes our array, and and then we'll split that into a layer with 200 nodes and then another layer with 80 nodes, and then we'll output our final prediction which should be the y value. Given the size of our dataset, this model should take a very long time to train. The next thing we'll do is compile the model. We'll give it a standard gradient descent optimizer, and then we'll be optimizing for the mean squared error. Currently, I'm writing this code on our initial VM that just has the 2 CPU cores. It's running roughly one step in the epic per second. There are a total of 10 epics and 512 steps each, which means it should take about 90 minutes to finish the training on this network.
neural networks
data
data analysis
programming
machine learning
probability
modeling
artificial intelligence
software
visualization
deep learning
fitness
That's not too bad in the machine learning world, but let's see how much faster this would be on a TPU. I'm switching over to the other VM that's associated with the TPU, and then I'm adding some extra code here that will Hook up our existing model with the TPU.
machine learning
TensorFlow has a variety of different ways it can distribute data. In this case, we'll use the TPU distribution strategy. And will fit the model using the same parameters that we had before. And right away, you'll see a huge difference in performance. Each epic only takes about 15 seconds now. So So it takes about 90 minutes on a CPU, only takes about 2.5 minutes in a TPU.
But what's really awesome about all this is that we now have Says to the best development tools like Versus Code in the cloud while being able to scale up its computing resources based on the demands of the project or the size of the team. Software is starting to become just as good in the browser, if not better than it is installed on your local machine. Coder is a perfect example of that and something you'll definitely wanna check out. I'm gonna go ahead and wrap things up there. If this video helped you, please like and subscribe. And let me know what you wanna see next in the comments. Thanks for watching, and I will talk to you soon.
software
software development
youtube
infrastructure
video gaming
technology
social media
documentary
The beauty of Versus Code is that it starts out minimal, but allows you to customize it into a full blown integrated development environment. I really like the Atom 1 dark syntax theme, Versus Code icons. I have a bunch of custom workspace settings and extensions that I just couldn't live without. But the problem is that all these customizations are tied to my local machine. But fortunately, a company called Coder just recently open sourced a project called CodeServer that allows you to run Versus Code in the cloud. In today's video, I'll show you how to run your own instance of CodeServer on Google Cloud Platform, and will supercharge it with a tensor processing unit, which will give it access to a massive amount of computing resources for machine learning. If you're new here, like and subscribe, and you can find a step by step breakdown of this video on Fireship IO. Let's start by taking a look at Coder. This is a startup that has in Versus Code and made it available in the browser. This allows you to access your IDE with all of its settings from any machine, even a cell phone or tablet if you wanted It also allows multiple developers to collaborate on the same project from the same editor. And because you can self host it, you can attach an unlimited amount of computing resources to its back end. The easiest way to get started is to just log into Coder, and it will immediately bring you to this instance of Versus Code. And the awesome thing about this is that it feels just like the Versus Code on your desktop. So the first thing I'll do is go to the extensions and then install the atom 1 dark theme. Much better. And if we open a terminal session, you can see that we have access to the the actual virtual machine that's running this container. It doesn't come with Node JS installed by default, so I'm going to the node version manager repo and grabbing the install command. That installs Node version manager on the container, then we can use NVM to install Node itself. At this point, we could install Angular or React and start doing front end development from this virtual environment. When developing in the browser, you might notice a small amount of lag when saving files because that has to happen remotely. But when you're actually writing code, it should feel just like you're working in the desktop version of s code. Now Coder gives us a couple gigabytes of memory and storage space, but there's a good chance you'll want to go beyond these limits by hosting your own instance in the cloud, which You can do on AWS, GCP, Azure, or wherever you want. We'll set up ours on Google Cloud, and I want to show you how to set it up for both front end development and also for machine learning, specifically with TensorFlow. Start by going to the GCP console and find the Compute Engine tab. We'll create our own virtual machine with some customized settings. Keep in mind this will accrue cost on GCP, so make sure to shut it down when you're done using it. And everything is built to the second, so you only have to have your virtual machine running when you're actually using Versus Code in the cloud. The smallest possible instance is about $4 per month, but but that's probably not going to be quite enough to run Versus Code comfortably. It's recommended to start with a standard instance with 2 CPU cores and 7.5 gigabytes of memory. That'll cost you about 6¢ per hour to run or about $49 per month if you just leave it running continuously. I'm just going to go with the recommended 2 CPU cores here, and then we're going to set the operating system to Ubuntu 16.04. We're going to be accessing it on the web, so we'll make sure to allow HTTP and HTTPS traffic. Go ahead and click create, and then you should see a green check mark when it's ready. The next thing we wanna do is install code server, which is the open source project that powers Coder. In order to do that, we need to get access to the command line of this virtual machine as the administrator. You'll see this SSH button next to your VM. If If you click that, it'll give you several different options for starting a terminal session. The easiest option is to just run-in Cloud Shell, which will bring up a command line in the browser window. From there, we'll go back to GitHub to find the download link for the latest release of code server on Linux. Next, we'll use the w git command, which gets things from the web on Linux along with this download URL. That will download code server to the actual file system on this virtual machine. When that's done, we'll go ahead and unzip it using the tar command. Then we can CD into the unzip directory, and that contains the actual binary that will run Versus Code in the browser. We'll prefix Fix the command with sudo and then point to the code server binary and then add flag p to run it on port 80. That should tell you that it's running on local host Eighty and then notice the password in the middle. You'll wanna make sure to copy that, and then you can link directly to your external IP from the GCP console. From there, you'll want to add port 80 to the end of that IP, and it'll give you a warning that this connection is not private. You can ignore that warning by going down to advanced and then proceed to the IP URL. From there, it's going to ask you for a password to access the IDE, copy and paste that in from the terminal output, and we now have our own version of Versus Code running on GCP. It's going to look and feel exactly like the demo that we looked at earlier on coder.com, but now we have full control over the underlying compute resources. I've already gone ahead and installed my preferred themes and also Node and Angular. I'm going to generate a new Angular app and then try to serve it on this local machine. Angular serves on port 42100 by default. And if we try to go to port 42100 on this IP address, you can see that the connection is refused. That's because VMs on Google have a firewall implemented by default. If you're doing front end development, you'll probably want to adjust the settings of the firewall, which you can do by going to the network details for this VM. There's a few different ways you can do this. For example, you can just change the default rule to allow a higher range of ports, but you have fine grain control over how the firewall works. So if you want to create your own firewall rule, you can do one that Typically allows port 42100 for Angular. I'm setting mine up for the more general port of 8080, and we just check the box for TCP and allow traffic to that port. It's also important to give it a tag because you can use that tag to apply it to specific VMs. If we go ahead and save this rule and then go back to our VM details, You'll see an option for network tags. Just enter the tag that you use for your firewall rule, and then you should be good to go to allow traffic to the specified port. If we go back to that port on the IP address, we should be able to refresh it and see our Angular app being served there now. So that's how you get started with front end development with Coder. What I really wanna show you is how to wire that Versus Code with some of the most advanced computing hardware out there. A tensor processing unit or TPU is It's a piece of hardware designed for large scale machine learning problems. They're used to train AI models for things like Gmail, Google Search, Google Translate, and they just recently became available to the public. If you're looking to get into deep learning, a TPU is a lot more cost effective and a lot more powerful than a typical NVIDIA GPU graphics card. Let's start by going to the TPU's tab on Compute Engine. TPU's are not cheap. You'll definitely wanna make sure you delete this when you're done using it. Otherwise, you'll be looking at about $3,000 per month or 4:50 per hour, but that's actually very reasonable considering how much computing power is behind these things. You can create your TPU from the console, but I actually find it easier to do from the command line. So we'll open up a new session here, and then we'll run c TPU up. And this is going to create a TPU node as well as a virtual machine that we can use to interact with that node and run code. It will also install TensorFlow in that VM, so it takes care of some of the setup for us. You'll notice another VM running in the VM instance list. This one's not going to have code server installed, so you'll need to go through the exact same process that we went through earlier. I'm not going to cover it in this video, but if you're spinning up multiple instances with Coder installed, you'll definitely want to save a disk image that you can reuse or a Docker container. TensorFlow is a Python library, and I already have it installed on both of my virtual machines. I'm not going to cover the basics of machine learning here, but mostly wanna show you the performance difference from a CPU to a TPU. And we'll do that by creating a problem here that uses a neural network to process a lot of synthetic or fake data. The first thing we'll do is create a data size of 2 to the 18th power, and then we'll use linspace to create an array with an interval of values based on that size. Then Then we'll go ahead and randomly shuffle that array, and then we'll format this data so that it randomly follows the shape of a sine wave. So each Each point will be an x y value and then we'll set up our neural network to try to predict the y value of this dataset. So this is what the dataset looks like visually. You can see there's some random noise in here and the neural network will try to fit a line that best generalizes this data. The next thing I'm doing is separating this data into a training set and a testing set by simply slicing the array. Then we'll define a function called get model that uses Keras to create a basic neural network. It starts with an input layer that just takes our array, and and then we'll split that into a layer with 200 nodes and then another layer with 80 nodes, and then we'll output our final prediction which should be the y value. Given the size of our dataset, this model should take a very long time to train. The next thing we'll do is compile the model. We'll give it a standard gradient descent optimizer, and then we'll be optimizing for the mean squared error. Currently, I'm writing this code on our initial VM that just has the 2 CPU cores. It's running roughly one step in the epic per second. There are a total of 10 epics and 512 steps each, which means it should take about 90 minutes to finish the training on this network. That's not too bad in the machine learning world, but let's see how much faster this would be on a TPU. I'm switching over to the other VM that's associated with the TPU, and then I'm adding some extra code here that will Hook up our existing model with the TPU. TensorFlow has a variety of different ways it can distribute data. In this case, we'll use the TPU distribution strategy. And will fit the model using the same parameters that we had before. And right away, you'll see a huge difference in performance. Each epic only takes about 15 seconds now. So So it takes about 90 minutes on a CPU, only takes about 2.5 minutes in a TPU. But what's really awesome about all this is that we now have Says to the best development tools like Versus Code in the cloud while being able to scale up its computing resources based on the demands of the project or the size of the team. Software is starting to become just as good in the browser, if not better than it is installed on your local machine. Coder is a perfect example of that and something you'll definitely wanna check out. I'm gonna go ahead and wrap things up there. If this video helped you, please like and subscribe. And let me know what you wanna see next in the comments. Thanks for watching, and I will talk to you soon.
The
the
beauty
beauty
of
of
Versus
versus
Code
code
is
is
that
that
it
it
starts
starts
out
out
minimal,
minimal
but
but
allows
allows
you
you
to
to
customize
customize
it
it
into
into
a
a
full
full
blown
blown
integrated
integrated
development
development
environment.
environment
I
i
really
really
like
like
the
the
Atom
atom
1
1
dark
dark
syntax
syntax
theme,
theme
Versus
versus
Code
code
icons.
icons
I
i
have
have
a
a
bunch
bunch
of
of
custom
custom
workspace
workspace
settings
settings
and
and
extensions
extensions
that
that
I
i
just
just
couldn't
couldn't
live
live
without.
without
But
but
the
the
problem
problem
is
is
that
that
all
all
these
these
customizations
customizations
are
are
tied
tied
to
to
my
my
local
local
machine.
machine
But
but
fortunately,
fortunately
a
a
company
company
called
called
Coder
coder
just
just
recently
recently
open
open
sourced
sourced
a
a
project
project
called
called
CodeServer
codeserver
that
that
allows
allows
you
you
to
to
run
run
Versus
versus
Code
code
in
in
the
the
cloud.
cloud
In
in
today's
today's
video,
video
I'll
i'll
show
show
you
you
how
how
to
to
run
run
your
your
own
own
instance
instance
of
of
CodeServer
codeserver
on
on
Google
google
Cloud
cloud
Platform,
platform
and
and
will
will
supercharge
supercharge
it
it
with
with
a
a
tensor
tensor
processing
processing
unit,
unit
which
which
will
will
give
give
it
it
access
access
to
to
a
a
massive
massive
amount
amount
of
of
computing
computing
resources
resources
for
for
machine
machine
learning.
learning
If
if
you're
you're
new
new
here,
here
like
like
and
and
subscribe,
subscribe
and
and
you
you
can
can
find
find
a
a
step
step
by
by
step
step
breakdown
breakdown
of
of
this
this
video
video
on
on
Fireship
fireship
IO.
io
Let's
let's
start
start
by
by
taking
taking
a
a
look
look
at
at
Coder.
coder
This
this
is
is
a
a
startup
startup
that
that
has
has
in
in
Versus
versus
Code
code
and
and
made
made
it
it
available
available
in
in
the
the
browser.
browser
This
this
allows
allows
you
you
to
to
access
access
your
your
IDE
ide
with
with
all
all
of
of
its
its
settings
settings
from
from
any
any
machine,
machine
even
even
a
a
cell
cell
phone
phone
or
or
tablet
tablet
if
if
you
you
wanted
wanted
It
it
also
also
allows
allows
multiple
multiple
developers
developers
to
to
collaborate
collaborate
on
on
the
the
same
same
project
project
from
from
the
the
same
same
editor.
editor
And
and
because
because
you
you
can
can
self
self
host
host
it,
it
you
you
can
can
attach
attach
an
an
unlimited
unlimited
amount
amount
of
of
computing
computing
resources
resources
to
to
its
its
back
back
end.
end
The
the
easiest
easiest
way
way
to
to
get
get
started
started
is
is
to
to
just
just
log
log
into
into
Coder,
coder
and
and
it
it
will
will
immediately
immediately
bring
bring
you
you
to
to
this
this
instance
instance
of
of
Versus
versus
Code.
code
And
and
the
the
awesome
awesome
thing
thing
about
about
this
this
is
is
that
that
it
it
feels
feels
just
just
like
like
the
the
Versus
versus
Code
code
on
on
your
your
desktop.
desktop
So
so
the
the
first
first
thing
thing
I'll
i'll
do
do
is
is
go
go
to
to
the
the
extensions
extensions
and
and
then
then
install
install
the
the
atom
atom
1
1
dark
dark
theme.
theme
Much
much
better.
better
And
and
if
if
we
we
open
open
a
a
terminal
terminal
session,
session
you
you
can
can
see
see
that
that
we
we
have
have
access
access
to
to
the
the
the
the
actual
actual
virtual
virtual
machine
machine
that's
that's
running
running
this
this
container.
container
It
it
doesn't
doesn't
come
come
with
with
Node
node
JS
js
installed
installed
by
by
default,
default
so
so
I'm
i'm
going
going
to
to
the
the
node
node
version
version
manager
manager
repo
repo
and
and
grabbing
grabbing
the
the
install
install
command.
command
That
that
installs
installs
Node
node
version
version
manager
manager
on
on
the
the
container,
container
then
then
we
we
can
can
use
use
NVM
nvm
to
to
install
install
Node
node
itself.
itself
At
at
this
this
point,
point
we
we
could
could
install
install
Angular
angular
or
or
React
react
and
and
start
start
doing
doing
front
front
end
end
development
development
from
from
this
this
virtual
virtual
environment.
environment
When
when
developing
developing
in
in
the
the
browser,
browser
you
you
might
might
notice
notice
a
a
small
small
amount
amount
of
of
lag
lag
when
when
saving
saving
files
files
because
because
that
that
has
has
to
to
happen
happen
remotely.
remotely
But
but
when
when
you're
you're
actually
actually
writing
writing
code,
code
it
it
should
should
feel
feel
just
just
like
like
you're
you're
working
working
in
in
the
the
desktop
desktop
version
version
of
of
s
s
code.
code
Now
now
Coder
coder
gives
gives
us
us
a
a
couple
couple
gigabytes
gigabytes
of
of
memory
memory
and
and
storage
storage
space,
space
but
but
there's
there's
a
a
good
good
chance
chance
you'll
you'll
want
want
to
to
go
go
beyond
beyond
these
these
limits
limits
by
by
hosting
hosting
your
your
own
own
instance
instance
in
in
the
the
cloud,
cloud
which
which
You
you
can
can
do
do
on
on
AWS,
aws
GCP,
gcp
Azure,
azure
or
or
wherever
wherever
you
you
want.
want
We'll
we'll
set
set
up
up
ours
ours
on
on
Google
google
Cloud,
cloud
and
and
I
i
want
want
to
to
show
show
you
you
how
how
to
to
set
set
it
it
up
up
for
for
both
both
front
front
end
end
development
development
and
and
also
also
for
for
machine
machine
learning,
learning
specifically
specifically
with
with
TensorFlow.
tensorflow
Start
start
by
by
going
going
to
to
the
the
GCP
gcp
console
console
and
and
find
find
the
the
Compute
compute
Engine
engine
tab.
tab
We'll
we'll
create
create
our
our
own
own
virtual
virtual
machine
machine
with
with
some
some
customized
customized
settings.
settings
Keep
keep
in
in
mind
mind
this
this
will
will
accrue
accrue
cost
cost
on
on
GCP,
gcp
so
so
make
make
sure
sure
to
to
shut
shut
it
it
down
down
when
when
you're
you're
done
done
using
using
it.
it
And
and
everything
everything
is
is
built
built
to
to
the
the
second,
second
so
so
you
you
only
only
have
have
to
to
have
have
your
your
virtual
virtual
machine
machine
running
running
when
when
you're
you're
actually
actually
using
using
Versus
versus
Code
code
in
in
the
the
cloud.
cloud
The
the
smallest
smallest
possible
possible
instance
instance
is
is
about
about
$4
$4
per
per
month,
month
but
but
but
but
that's
that's
probably
probably
not
not
going
going
to
to
be
be
quite
quite
enough
enough
to
to
run
run
Versus
versus
Code
code
comfortably.
comfortably
It's
it's
recommended
recommended
to
to
start
start
with
with
a
a
standard
standard
instance
instance
with
with
2
2
CPU
cpu
cores
cores
and
and
7.5
7.5
gigabytes
gigabytes
of
of
memory.
memory
That'll
that'll
cost
cost
you
you
about
about
6¢
6¢
per
per
hour
hour
to
to
run
run
or
or
about
about
$49
$49
per
per
month
month
if
if
you
you
just
just
leave
leave
it
it
running
running
continuously.
continuously
I'm
i'm
just
just
going
going
to
to
go
go
with
with
the
the
recommended
recommended
2
2
CPU
cpu
cores
cores
here,
here
and
and
then
then
we're
we're
going
going
to
to
set
set
the
the
operating
operating
system
system
to
to
Ubuntu
ubuntu
16.04.
16.04
We're
we're
going
going
to
to
be
be
accessing
accessing
it
it
on
on
the
the
web,
web
so
so
we'll
we'll
make
make
sure
sure
to
to
allow
allow
HTTP
http
and
and
HTTPS
https
traffic.
traffic
Go
go
ahead
ahead
and
and
click
click
create,
create
and
and
then
then
you
you
should
should
see
see
a
a
green
green
check
check
mark
mark
when
when
it's
it's
ready.
ready
The
the
next
next
thing
thing
we
we
wanna
wanna
do
do
is
is
install
install
code
code
server,
server
which
which
is
is
the
the
open
open
source
source
project
project
that
that
powers
powers
Coder.
coder
In
in
order
order
to
to
do
do
that,
that
we
we
need
need
to
to
get
get
access
access
to
to
the
the
command
command
line
line
of
of
this
this
virtual
virtual
machine
machine
as
as
the
the
administrator.
administrator
You'll
you'll
see
see
this
this
SSH
ssh
button
button
next
next
to
to
your
your
VM.
vm
If
if
If
if
you
you
click
click
that,
that
it'll
it'll
give
give
you
you
several
several
different
different
options
options
for
for
starting
starting
a
a
terminal
terminal
session.
session
The
the
easiest
easiest
option
option
is
is
to
to
just
just
run-in
run-in
Cloud
cloud
Shell,
shell
which
which
will
will
bring
bring
up
up
a
a
command
command
line
line
in
in
the
the
browser
browser
window.
window
From
from
there,
there
we'll
we'll
go
go
back
back
to
to
GitHub
github
to
to
find
find
the
the
download
download
link
link
for
for
the
the
latest
latest
release
release
of
of
code
code
server
server
on
on
Linux.
linux
Next,
next
we'll
we'll
use
use
the
the
w
w
git
git
command,
command
which
which
gets
gets
things
things
from
from
the
the
web
web
on
on
Linux
linux
along
along
with
with
this
this
download
download
URL.
url
That
that
will
will
download
download
code
code
server
server
to
to
the
the
actual
actual
file
file
system
system
on
on
this
this
virtual
virtual
machine.
machine
When
when
that's
that's
done,
done
we'll
we'll
go
go
ahead
ahead
and
and
unzip
unzip
it
it
using
using
the
the
tar
tar
command.
command
Then
then
we
we
can
can
CD
cd
into
into
the
the
unzip
unzip
directory,
directory
and
and
that
that
contains
contains
the
the
actual
actual
binary
binary
that
that
will
will
run
run
Versus
versus
Code
code
in
in
the
the
browser.
browser
We'll
we'll
prefix
prefix
Fix
fix
the
the
command
command
with
with
sudo
sudo
and
and
then
then
point
point
to
to
the
the
code
code
server
server
binary
binary
and
and
then
then
add
add
flag
flag
p
p
to
to
run
run
it
it
on
on
port
port
80.
80
That
that
should
should
tell
tell
you
you
that
that
it's
it's
running
running
on
on
local
local
host
host
Eighty
eighty
and
and
then
then
notice
notice
the
the
password
password
in
in
the
the
middle.
middle
You'll
you'll
wanna
wanna
make
make
sure
sure
to
to
copy
copy
that,
that
and
and
then
then
you
you
can
can
link
link
directly
directly
to
to
your
your
external
external
IP
ip
from
from
the
the
GCP
gcp
console.
console
From
from
there,
there
you'll
you'll
want
want
to
to
add
add
port
port
80
80
to
to
the
the
end
end
of
of
that
that
IP,
ip
and
and
it'll
it'll
give
give
you
you
a
a
warning
warning
that
that
this
this
connection
connection
is
is
not
not
private.
private
You
you
can
can
ignore
ignore
that
that
warning
warning
by
by
going
going
down
down
to
to
advanced
advanced
and
and
then
then
proceed
proceed
to
to
the
the
IP
ip
URL.
url
From
from
there,
there
it's
it's
going
going
to
to
ask
ask
you
you
for
for
a
a
password
password
to
to
access
access
the
the
IDE,
ide
copy
copy
and
and
paste
paste
that
that
in
in
from
from
the
the
terminal
terminal
output,
output
and
and
we
we
now
now
have
have
our
our
own
own
version
version
of
of
Versus
versus
Code
code
running
running
on
on
GCP.
gcp
It's
it's
going
going
to
to
look
look
and
and
feel
feel
exactly
exactly
like
like
the
the
demo
demo
that
that
we
we
looked
looked
at
at
earlier
earlier
on
on
coder.com,
coder.com
but
but
now
now
we
we
have
have
full
full
control
control
over
over
the
the
underlying
underlying
compute
compute
resources.
resources
I've
i've
already
already
gone
gone
ahead
ahead
and
and
installed
installed
my
my
preferred
preferred
themes
themes
and
and
also
also
Node
node
and
and
Angular.
angular
I'm
i'm
going
going
to
to
generate
generate
a
a
new
new
Angular
angular
app
app
and
and
then
then
try
try
to
to
serve
serve
it
it
on
on
this
this
local
local
machine.
machine
Angular
angular
serves
serves
on
on
port
port
42100
42100
by
by
default.
default
And
and
if
if
we
we
try
try
to
to
go
go
to
to
port
port
42100
42100
on
on
this
this
IP
ip
address,
address
you
you
can
can
see
see
that
that
the
the
connection
connection
is
is
refused.
refused
That's
that's
because
because
VMs
vms
on
on
Google
google
have
have
a
a
firewall
firewall
implemented
implemented
by
by
default.
default
If
if
you're
you're
doing
doing
front
front
end
end
development,
development
you'll
you'll
probably
probably
want
want
to
to
adjust
adjust
the
the
settings
settings
of
of
the
the
firewall,
firewall
which
which
you
you
can
can
do
do
by
by
going
going
to
to
the
the
network
network
details
details
for
for
this
this
VM.
vm
There's
there's
a
a
few
few
different
different
ways
ways
you
you
can
can
do
do
this.
this
For
for
example,
example
you
you
can
can
just
just
change
change
the
the
default
default
rule
rule
to
to
allow
allow
a
a
higher
higher
range
range
of
of
ports,
ports
but
but
you
you
have
have
fine
fine
grain
grain
control
control
over
over
how
how
the
the
firewall
firewall
works.
works
So
so
if
if
you
you
want
want
to
to
create
create
your
your
own
own
firewall
firewall
rule,
rule
you
you
can
can
do
do
one
one
that
that
Typically
typically
allows
allows
port
port
42100
42100
for
for
Angular.
angular
I'm
i'm
setting
setting
mine
mine
up
up
for
for
the
the
more
more
general
general
port
port
of
of
8080,
8080
and
and
we
we
just
just
check
check
the
the
box
box
for
for
TCP
tcp
and
and
allow
allow
traffic
traffic
to
to
that
that
port.
port
It's
it's
also
also
important
important
to
to
give
give
it
it
a
a
tag
tag
because
because
you
you
can
can
use
use
that
that
tag
tag
to
to
apply
apply
it
it
to
to
specific
specific
VMs.
vms
If
if
we
we
go
go
ahead
ahead
and
and
save
save
this
this
rule
rule
and
and
then
then
go
go
back
back
to
to
our
our
VM
vm
details,
details
You'll
you'll
see
see
an
an
option
option
for
for
network
network
tags.
tags
Just
just
enter
enter
the
the
tag
tag
that
that
you
you
use
use
for
for
your
your
firewall
firewall
rule,
rule
and
and
then
then
you
you
should
should
be
be
good
good
to
to
go
go
to
to
allow
allow
traffic
traffic
to
to
the
the
specified
specified
port.
port
If
if
we
we
go
go
back
back
to
to
that
that
port
port
on
on
the
the
IP
ip
address,
address
we
we
should
should
be
be
able
able
to
to
refresh
refresh
it
it
and
and
see
see
our
our
Angular
angular
app
app
being
being
served
served
there
there
now.
now
So
so
that's
that's
how
how
you
you
get
get
started
started
with
with
front
front
end
end
development
development
with
with
Coder.
coder
What
what
I
i
really
really
wanna
wanna
show
show
you
you
is
is
how
how
to
to
wire
wire
that
that
Versus
versus
Code
code
with
with
some
some
of
of
the
the
most
most
advanced
advanced
computing
computing
hardware
hardware
out
out
there.
there
A
a
tensor
tensor
processing
processing
unit
unit
or
or
TPU
tpu
is
is
It's
it's
a
a
piece
piece
of
of
hardware
hardware
designed
designed
for
for
large
large
scale
scale
machine
machine
learning
learning
problems.
problems
They're
they're
used
used
to
to
train
train
AI
ai
models
models
for
for
things
things
like
like
Gmail,
gmail
Google
google
Search,
search
Google
google
Translate,
translate
and
and
they
they
just
just
recently
recently
became
became
available
available
to
to
the
the
public.
public
If
if
you're
you're
looking
looking
to
to
get
get
into
into
deep
deep
learning,
learning
a
a
TPU
tpu
is
is
a
a
lot
lot
more
more
cost
cost
effective
effective
and
and
a
a
lot
lot
more
more
powerful
powerful
than
than
a
a
typical
typical
NVIDIA
nvidia
GPU
gpu
graphics
graphics
card.
card
Let's
let's
start
start
by
by
going
going
to
to
the
the
TPU's
tpu's
tab
tab
on
on
Compute
compute
Engine.
engine
TPU's
tpu's
are
are
not
not
cheap.
cheap
You'll
you'll
definitely
definitely
wanna
wanna
make
make
sure
sure
you
you
delete
delete
this
this
when
when
you're
you're
done
done
using
using
it.
it
Otherwise,
otherwise
you'll
you'll
be
be
looking
looking
at
at
about
about
$3,000
$3,000
per
per
month
month
or
or
4:50
4:50
per
per
hour,
hour
but
but
that's
that's
actually
actually
very
very
reasonable
reasonable
considering
considering
how
how
much
much
computing
computing
power
power
is
is
behind
behind
these
these
things.
things
You
you
can
can
create
create
your
your
TPU
tpu
from
from
the
the
console,
console
but
but
I
i
actually
actually
find
find
it
it
easier
easier
to
to
do
do
from
from
the
the
command
command
line.
line
So
so
we'll
we'll
open
open
up
up
a
a
new
new
session
session
here,
here
and
and
then
then
we'll
we'll
run
run
c
c
TPU
tpu
up.
up
And
and
this
this
is
is
going
going
to
to
create
create
a
a
TPU
tpu
node
node
as
as
well
well
as
as
a
a
virtual
virtual
machine
machine
that
that
we
we
can
can
use
use
to
to
interact
interact
with
with
that
that
node
node
and
and
run
run
code.
code
It
it
will
will
also
also
install
install
TensorFlow
tensorflow
in
in
that
that
VM,
vm
so
so
it
it
takes
takes
care
care
of
of
some
some
of
of
the
the
setup
setup
for
for
us.
us
You'll
you'll
notice
notice
another
another
VM
vm
running
running
in
in
the
the
VM
vm
instance
instance
list.
list
This
this
one's
one's
not
not
going
going
to
to
have
have
code
code
server
server
installed,
installed
so
so
you'll
you'll
need
need
to
to
go
go
through
through
the
the
exact
exact
same
same
process
process
that
that
we
we
went
went
through
through
earlier.
earlier
I'm
i'm
not
not
going
going
to
to
cover
cover
it
it
in
in
this
this
video,
video
but
but
if
if
you're
you're
spinning
spinning
up
up
multiple
multiple
instances
instances
with
with
Coder
coder
installed,
installed
you'll
you'll
definitely
definitely
want
want
to
to
save
save
a
a
disk
disk
image
image
that
that
you
you
can
can
reuse
reuse
or
or
a
a
Docker
docker
container.
container
TensorFlow
tensorflow
is
is
a
a
Python
python
library,
library
and
and
I
i
already
already
have
have
it
it
installed
installed
on
on
both
both
of
of
my
my
virtual
virtual
machines.
machines
I'm
i'm
not
not
going
going
to
to
cover
cover
the
the
basics
basics
of
of
machine
machine
learning
learning
here,
here
but
but
mostly
mostly
wanna
wanna
show
show
you
you
the
the
performance
performance
difference
difference
from
from
a
a
CPU
cpu
to
to
a
a
TPU.
tpu
And
and
we'll
we'll
do
do
that
that
by
by
creating
creating
a
a
problem
problem
here
here
that
that
uses
uses
a
a
neural
neural
network
network
to
to
process
process
a
a
lot
lot
of
of
synthetic
synthetic
or
or
fake
fake
data.
data
The
the
first
first
thing
thing
we'll
we'll
do
do
is
is
create
create
a
a
data
data
size
size
of
of
2
2
to
to
the
the
18th
18th
power,
power
and
and
then
then
we'll
we'll
use
use
linspace
linspace
to
to
create
create
an
an
array
array
with
with
an
an
interval
interval
of
of
values
values
based
based
on
on
that
that
size.
size
Then
then
Then
then
we'll
we'll
go
go
ahead
ahead
and
and
randomly
randomly
shuffle
shuffle
that
that
array,
array
and
and
then
then
we'll
we'll
format
format
this
this
data
data
so
so
that
that
it
it
randomly
randomly
follows
follows
the
the
shape
shape
of
of
a
a
sine
sine
wave.
wave
So
so
each
each
Each
each
point
point
will
will
be
be
an
an
x
x
y
y
value
value
and
and
then
then
we'll
we'll
set
set
up
up
our
our
neural
neural
network
network
to
to
try
try
to
to
predict
predict
the
the
y
y
value
value
of
of
this
this
dataset.
dataset
So
so
this
this
is
is
what
what
the
the
dataset
dataset
looks
looks
like
like
visually.
visually
You
you
can
can
see
see
there's
there's
some
some
random
random
noise
noise
in
in
here
here
and
and
the
the
neural
neural
network
network
will
will
try
try
to
to
fit
fit
a
a
line
line
that
that
best
best
generalizes
generalizes
this
this
data.
data
The
the
next
next
thing
thing
I'm
i'm
doing
doing
is
is
separating
separating
this
this
data
data
into
into
a
a
training
training
set
set
and
and
a
a
testing
testing
set
set
by
by
simply
simply
slicing
slicing
the
the
array.
array
Then
then
we'll
we'll
define
define
a
a
function
function
called
called
get
get
model
model
that
that
uses
uses
Keras
keras
to
to
create
create
a
a
basic
basic
neural
neural
network.
network
It
it
starts
starts
with
with
an
an
input
input
layer
layer
that
that
just
just
takes
takes
our
our
array,
array
and
and
and
and
then
then
we'll
we'll
split
split
that
that
into
into
a
a
layer
layer
with
with
200
200
nodes
nodes
and
and
then
then
another
another
layer
layer
with
with
80
80
nodes,
nodes
and
and
then
then
we'll
we'll
output
output
our
our
final
final
prediction
prediction
which
which
should
should
be
be
the
the
y
y
value.
value
Given
given
the
the
size
size
of
of
our
our
dataset,
dataset
this
this
model
model
should
should
take
take
a
a
very
very
long
long
time
time
to
to
train.
train
The
the
next
next
thing
thing
we'll
we'll
do
do
is
is
compile
compile
the
the
model.
model
We'll
we'll
give
give
it
it
a
a
standard
standard
gradient
gradient
descent
descent
optimizer,
optimizer
and
and
then
then
we'll
we'll
be
be
optimizing
optimizing
for
for
the
the
mean
mean
squared
squared
error.
error
Currently,
currently
I'm
i'm
writing
writing
this
this
code
code
on
on
our
our
initial
initial
VM
vm
that
that
just
just
has
has
the
the
2
2
CPU
cpu
cores.
cores
It's
it's
running
running
roughly
roughly
one
one
step
step
in
in
the
the
epic
epic
per
per
second.
second
There
there
are
are
a
a
total
total
of
of
10
10
epics
epics
and
and
512
512
steps
steps
each,
each
which
which
means
means
it
it
should
should
take
take
about
about
90
90
minutes
minutes
to
to
finish
finish
the
the
training
training
on
on
this
this
network.
network
That's
that's
not
not
too
too
bad
bad
in
in
the
the
machine
machine
learning
learning
world,
world
but
but
let's
let's
see
see
how
how
much
much
faster
faster
this
this
would
would
be
be
on
on
a
a
TPU.
tpu
I'm
i'm
switching
switching
over
over
to
to
the
the
other
other
VM
vm
that's
that's
associated
associated
with
with
the
the
TPU,
tpu
and
and
then
then
I'm
i'm
adding
adding
some
some
extra
extra
code
code
here
here
that
that
will
will
Hook
hook
up
up
our
our
existing
existing
model
model
with
with
the
the
TPU.
tpu
TensorFlow
tensorflow
has
has
a
a
variety
variety
of
of
different
different
ways
ways
it
it
can
can
distribute
distribute
data.
data
In
in
this
this
case,
case
we'll
we'll
use
use
the
the
TPU
tpu
distribution
distribution
strategy.
strategy
And
and
will
will
fit
fit
the
the
model
model
using
using
the
the
same
same
parameters
parameters
that
that
we
we
had
had
before.
before
And
and
right
right
away,
away
you'll
you'll
see
see
a
a
huge
huge
difference
difference
in
in
performance.
performance
Each
each
epic
epic
only
only
takes
takes
about
about
15
15
seconds
seconds
now.
now
So
so
So
so
it
it
takes
takes
about
about
90
90
minutes
minutes
on
on
a
a
CPU,
cpu
only
only
takes
takes
about
about
2.5
2.5
minutes
minutes
in
in
a
a
TPU.
tpu
But
but
what's
what's
really
really
awesome
awesome
about
about
all
all
this
this
is
is
that
that
we
we
now
now
have
have
Says
says
to
to
the
the
best
best
development
development
tools
tools
like
like
Versus
versus
Code
code
in
in
the
the
cloud
cloud
while
while
being
being
able
able
to
to
scale
scale
up
up
its
its
computing
computing
resources
resources
based
based
on
on
the
the
demands
demands
of
of
the
the
project
project
or
or
the
the
size
size
of
of
the
the
team.
team
Software
software
is
is
starting
starting
to
to
become
become
just
just
as
as
good
good
in
in
the
the
browser,
browser
if
if
not
not
better
better
than
than
it
it
is
is
installed
installed
on
on
your
your
local
local
machine.
machine
Coder
coder
is
is
a
a
perfect
perfect
example
example
of
of
that
that
and
and
something
something
you'll
you'll
definitely
definitely
wanna
wanna
check
check
out.
out
I'm
i'm
gonna
gonna
go
go
ahead
ahead
and
and
wrap
wrap
things
things
up
up
there.
there
If
if
this
this
video
video
helped
helped
you,
you
please
please
like
like
and
and
subscribe.
subscribe
And
and
let
let
me
me
know
know
what
what
you
you
wanna
wanna
see
see
next
next
in
in
the
the
comments.
comments
Thanks
thanks
for
for
watching,
watching
and
and
I
i
will
will
talk
talk
to
to
you
you
soon.
soon
success
The speakers discuss the benefits of Versus Code, a cloud-based development environment that allows for customization and access to large amounts of computing resources. They provide instructions on setting up a Coder instance on Google Cloud Platform, installing code server, and using the w git command. They also explain how to wire the machine with front-end development and the performance differences between CPU and TPU machines, creating a TPU and creating a neural network to predict y values for a dataset, and using the tool for machine learning problems. The speakers also mention the benefits of using the tool for better computers and how to scale up computing resources and reduce the time it takes to train.
Run VS Code in the browser with massive computing resources
The beauty of Versus Code is that it starts out minimal, but allows you to customize it into a full blown integrated development environment. I really like the Atom 1 dark syntax theme, Versus Code icons. I have a bunch of custom workspace settings and extensions that I just couldn't live without. But the problem is that all these customizations are tied to my local machine. But fortunately, a company called Coder just recently open sourced a project called CodeServer that allows you to run Versus Code in the cloud. In today's video, I'll show you how to run your own instance of CodeServer on Google Cloud Platform, and will supercharge it with a tensor processing unit, which will give it access to a massive amount of computing resources for machine learning. If you're new here, like and subscribe, and you can find a step by step breakdown of this video on Fireship IO. Let's start by taking a look at Coder. This is a startup that has in Versus Code and made it available in the browser. This allows you to access your IDE with all of its settings from any machine, even a cell phone or tablet if you wanted It also allows multiple developers to collaborate on the same project from the same editor. And because you can self host it, you can attach an unlimited amount of computing resources to its back end. The easiest way to get started is to just log into Coder, and it will immediately bring you to this instance of Versus Code. And the awesome thing about this is that it feels just like the Versus Code on your desktop. So the first thing I'll do is go to the extensions and then install the atom 1 dark theme. Much better. And if we open a terminal session, you can see that we have access to the the actual virtual machine that's running this container. It doesn't come with Node JS installed by default, so I'm going to the node version manager repo and grabbing the install command. That installs Node version manager on the container, then we can use NVM to install Node itself. At this point, we could install Angular or React and start doing front end development from this virtual environment. When developing in the browser, you might notice a small amount of lag when saving files because that has to happen remotely. But when you're actually writing code, it should feel just like you're working in the desktop version of s code. Now Coder gives us a couple gigabytes of memory and storage space, but there's a good chance you'll want to go beyond these limits by hosting your own instance in the cloud, which You can do on AWS, GCP, Azure, or wherever you want. We'll set up ours on Google Cloud, and I want to show you how to set it up for both front end development and also for machine learning, specifically with TensorFlow. Start by going to the GCP console and find the Compute Engine tab. We'll create our own virtual machine with some customized settings. Keep in mind this will accrue cost on GCP, so make sure to shut it down when you're done using it. And everything is built to the second, so you only have to have your virtual machine running when you're actually using Versus Code in the cloud. The smallest possible instance is about $4 per month, but but that's probably not going to be quite enough to run Versus Code comfortably. It's recommended to start with a standard instance with 2 CPU cores and 7.5 gigabytes of memory. That'll cost you about 6¢ per hour to run or about $49 per month if you just leave it running continuously. I'm just going to go with the recommended 2 CPU cores here, and then we're going to set the operating system to Ubuntu 16.04. We're going to be accessing it on the web, so we'll make sure to allow HTTP and HTTPS traffic. Go ahead and click create, and then you should see a green check mark when it's ready. The next thing we wanna do is install code server, which is the open source project that powers Coder. In order to do that, we need to get access to the command line of this virtual machine as the administrator. You'll see this SSH button next to your VM. If If you click that, it'll give you several different options for starting a terminal session. The easiest option is to just run-in Cloud Shell, which will bring up a command line in the browser window. From there, we'll go back to GitHub to find the download link for the latest release of code server on Linux. Next, we'll use the w git command, which gets things from the web on Linux along with this download URL. That will download code server to the actual file system on this virtual machine. When that's done, we'll go ahead and unzip it using the tar command. Then we can CD into the unzip directory, and that contains the actual binary that will run Versus Code in the browser. We'll prefix Fix the command with sudo and then point to the code server binary and then add flag p to run it on port 80. That should tell you that it's running on local host Eighty and then notice the password in the middle. You'll wanna make sure to copy that, and then you can link directly to your external IP from the GCP console. From there, you'll want to add port 80 to the end of that IP, and it'll give you a warning that this connection is not private. You can ignore that warning by going down to advanced and then proceed to the IP URL. From there, it's going to ask you for a password to access the IDE, copy and paste that in from the terminal output, and we now have our own version of Versus Code running on GCP. It's going to look and feel exactly like the demo that we looked at earlier on coder.com, but now we have full control over the underlying compute resources. I've already gone ahead and installed my preferred themes and also Node and Angular. I'm going to generate a new Angular app and then try to serve it on this local machine. Angular serves on port 42100 by default. And if we try to go to port 42100 on this IP address, you can see that the connection is refused. That's because VMs on Google have a firewall implemented by default. If you're doing front end development, you'll probably want to adjust the settings of the firewall, which you can do by going to the network details for this VM. There's a few different ways you can do this. For example, you can just change the default rule to allow a higher range of ports, but you have fine grain control over how the firewall works. So if you want to create your own firewall rule, you can do one that Typically allows port 42100 for Angular. I'm setting mine up for the more general port of 8080, and we just check the box for TCP and allow traffic to that port. It's also important to give it a tag because you can use that tag to apply it to specific VMs. If we go ahead and save this rule and then go back to our VM details, You'll see an option for network tags. Just enter the tag that you use for your firewall rule, and then you should be good to go to allow traffic to the specified port. If we go back to that port on the IP address, we should be able to refresh it and see our Angular app being served there now. So that's how you get started with front end development with Coder. What I really wanna show you is how to wire that Versus Code with some of the most advanced computing hardware out there. A tensor processing unit or TPU is It's a piece of hardware designed for large scale machine learning problems. They're used to train AI models for things like Gmail, Google Search, Google Translate, and they just recently became available to the public. If you're looking to get into deep learning, a TPU is a lot more cost effective and a lot more powerful than a typical NVIDIA GPU graphics card. Let's start by going to the TPU's tab on Compute Engine. TPU's are not cheap. You'll definitely wanna make sure you delete this when you're done using it. Otherwise, you'll be looking at about $3,000 per month or 4:50 per hour, but that's actually very reasonable considering how much computing power is behind these things. You can create your TPU from the console, but I actually find it easier to do from the command line. So we'll open up a new session here, and then we'll run c TPU up. And this is going to create a TPU node as well as a virtual machine that we can use to interact with that node and run code. It will also install TensorFlow in that VM, so it takes care of some of the setup for us. You'll notice another VM running in the VM instance list. This one's not going to have code server installed, so you'll need to go through the exact same process that we went through earlier. I'm not going to cover it in this video, but if you're spinning up multiple instances with Coder installed, you'll definitely want to save a disk image that you can reuse or a Docker container. TensorFlow is a Python library, and I already have it installed on both of my virtual machines. I'm not going to cover the basics of machine learning here, but mostly wanna show you the performance difference from a CPU to a TPU. And we'll do that by creating a problem here that uses a neural network to process a lot of synthetic or fake data. The first thing we'll do is create a data size of 2 to the 18th power, and then we'll use linspace to create an array with an interval of values based on that size. Then Then we'll go ahead and randomly shuffle that array, and then we'll format this data so that it randomly follows the shape of a sine wave. So each Each point will be an x y value and then we'll set up our neural network to try to predict the y value of this dataset. So this is what the dataset looks like visually. You can see there's some random noise in here and the neural network will try to fit a line that best generalizes this data. The next thing I'm doing is separating this data into a training set and a testing set by simply slicing the array. Then we'll define a function called get model that uses Keras to create a basic neural network. It starts with an input layer that just takes our array, and and then we'll split that into a layer with 200 nodes and then another layer with 80 nodes, and then we'll output our final prediction which should be the y value. Given the size of our dataset, this model should take a very long time to train. The next thing we'll do is compile the model. We'll give it a standard gradient descent optimizer, and then we'll be optimizing for the mean squared error. Currently, I'm writing this code on our initial VM that just has the 2 CPU cores. It's running roughly one step in the epic per second. There are a total of 10 epics and 512 steps each, which means it should take about 90 minutes to finish the training on this network. That's not too bad in the machine learning world, but let's see how much faster this would be on a TPU. I'm switching over to the other VM that's associated with the TPU, and then I'm adding some extra code here that will Hook up our existing model with the TPU. TensorFlow has a variety of different ways it can distribute data. In this case, we'll use the TPU distribution strategy. And will fit the model using the same parameters that we had before. And right away, you'll see a huge difference in performance. Each epic only takes about 15 seconds now. So So it takes about 90 minutes on a CPU, only takes about 2.5 minutes in a TPU. But what's really awesome about all this is that we now have Says to the best development tools like Versus Code in the cloud while being able to scale up its computing resources based on the demands of the project or the size of the team. Software is starting to become just as good in the browser, if not better than it is installed on your local machine. Coder is a perfect example of that and something you'll definitely wanna check out. I'm gonna go ahead and wrap things up there. If this video helped you, please like and subscribe. And let me know what you wanna see next in the comments. Thanks for watching, and I will talk to you soon.
The speakers discuss the benefits of Versus Code, a cloud-based development environment that allows for customization and access to large amounts of computing resources. They provide instructions on setting up a Coder instance on Google Cloud Platform, installing code server, and using the w git command. They also explain how to wire the machine with front-end development and the performance differences between CPU and TPU machines, creating a TPU and creating a neural network to predict y values for a dataset, and using the tool for machine learning problems. The speakers also mention the benefits of using the tool for better computers and how to scale up computing resources and reduce the time it takes to train.