当前位置:网站首页>Google lab usage notes
Google lab usage notes
2022-07-28 14:55:00 【javafalcon】
google Provided colab Provides GPU、TPU Operating environment , You can save a lot of money , In use, according to your own situation , I took a few notes for review from time to time .
1. The problem of path . For a question , Just write a ipynb The file shows that it is not conducive to the reusability of the code , I am used to writing some reusable code py file , And then in ipynb Used in documents import The command reference . stay colab In order to identify the path of the file , Follow these steps .
step1. Mount Directory . We copy the following code to a cell in , And run this cell
from google.colab import drive
drive.mount('/content/drive')
step 2. Change the directory to the folder you want to use
import os
os.chdir('drive/MyDrive/Colab/workfiles')
notes : here workfiles Your working directory , Take yours. ipynb Document and py Put the file in a directory and you can use it . File references between different directories , It hasn't been used yet , It will be supplemented later .
2. colab The problem of disconnection .colab It's easy to use , But if we run a program and then do something else , Not clicking on the page for a long time will cause colab disconnect , So our code interrupts execution , To keep the page connected , Follow these steps .
step 1. Click on Google browser “ Developer tools ”

step 2. Click in the developer tool “Concole”

step 3. Copy and paste the following code at the red horizontal line in the above figure :
function ClickConnect(){
colab.config
console.log("Connnect Clicked - Start");
document.querySelector("#top-toolbar > colab-connect-button").shadowRoot.querySelector("#connect").click();
console.log("Connnect Clicked - End");
};
setInterval(ClickConnect, 60000)
After copy and paste , You can enter. . In this way, you can make the web page every 60 One click per second . But in my own experiment, I found that such frequent clicks will lead to interruption , I usually set it to 10 One click per minute , Put the last line of 60000 Change it to 600000.
Statement :
This blog is just my own study notes , Not the original . All the methods are from others' blogs. Thank you here .
Note No 2 The dots come from CSDN Blogger 「 Today is another day of hope 」 The original article of ,
Link to the original text :https://blog.csdn.net/liupeng19970119/article/details/105625334
边栏推荐
- 7、 Detailed explanation of C language function definition
- Realization of chat room function
- 3、 C language storage class
- Hand in hand from 0 to a "Nuggets special attention" Google plug-in, 5000 words detailed vue3 responsive principle, the advantages, disadvantages and choices of several cache read-write schemes, flyin
- 【LeetCode】 贴纸拼词(动态规划)
- SSH service
- 35道MySQL面试必问题图解,这样也太好理解了吧
- Create a table under swiftui with table
- 7月29日 ApacheCon|Apache Pulsar 在 vivo 的探索与实践 即将开播
- SSL socket cross platform solution libevent OpenSSL
猜你喜欢

MQTT入门级简单介绍与使用

Redis-持久化

Qt development tips

十、时间戳

How to reduce the resolution of only 3D camera but not UI camera
C # 7 methods to obtain the current path

Many "double first-class" universities have launched the research guarantee and prediction name!
Some problems encountered in the development of Excel VBA, solutions, and continuous updates

2022 high altitude installation, maintenance, removal of examination question bank and online simulated examination

企鹅一面:为什么不建议使用SELECT * ?
随机推荐
Creating, deleting and viewing Anaconda virtual environment
Swiftui 4.0's new navigation system
RPC (remote procedure call protocol) telecommunication framework
Error reason for converting string to long type: to convert to long type, it must be int, double, float type [easy to understand]
QT environment cannot run error set
QT serialization qdatastream
How to use the C language library function getchar ()
QT qbuttongroup realizes single selection and multiple selection
14、 ROS meta function package
【七夕】七夕孤寡小青蛙究极版?七夕节最终章!
Added the ability of class @published for @cloudstorage
SwiftUI 布局 —— 尺寸( 下 )
OKR与GRAD
Introduction to MITK
Second class exercise
How many ways can multithread run in sequence?
Force deduction solution summary 1331 array sequence number conversion
SSH service
为自定义属性包装类型添加类 @Published 的能力
2、 Declaration and definition of variables and constants