1、How to solve automatically disconnection in Colab
Answer: by JavaScript of the console. Push the Ctrl Shift + I on this website, then a new page appears on the right of the web, tap console--IE tab extension, and add the following codes at the bottom of tap:
function ConnectButton(){
console.log("Connect pushed");
document.querySelector("#top-toolbar > colab-connect-button").shadowRoot.querySelector("#connect").click()
}
setInterval(ConnectButton,60000);
This function can tap the connection button every 1 min to keep connecting.
Then we can use Colab continuously for 12h a day.
If we want to end up, add(change) the following codes at the bottom of tap:
function ConnectButton(){
};
2. Use the GPU with Pytorch
It is not a bit acceleration by GPU instead of the default CPU. We just need a tip Edit--> notebook settings--> GPU
Remark: "colab-connect-button" will change at some point.