前提:代理选“德国”,稳定一点 ~

1. 将Colab与Good Drive关联起来

from google.colab import drive
drive.mount('/content/drive')

2.定位到Drive的根目录,并查看根目录下的文件

import os
os.chdir("/content/drive/My Drive")
!ls

3.下载GitHub的代码到Drive

Colab运行GitHub代码

!git clone https://github.com/wadayama/TISTA.git
!ls

4. 切换到刚才下载项目的文件夹下

cd TISTA/

5.查看文件夹下所有文件

!ls

6.修改TensorFlow版本为1.X,Colab默认使用TensorFlow 2.X

%tensorflow_version 1.1
import tensorflow
print(tensorflow.__version__)

7. 运行python程序

!python main.py

7.1 运行Python程序,并在notebook上显示plt图片

#!python main.py  #下面的运行方式
% run main.py
%matplotlib inline

 

如何查看GPU?

! /opt/bin/nvidia-smi

 

在本地如何TensorFlow2.0下运行TensorFlow1.X版本的代码

import tensorflow as tf
#-----修改为↓↓↓↓↓↓↓↓↓
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()

 

 

参考:

https://blog.csdn.net/tan123456987321/article/details/104777049

colab+git clone+Google drive提速: https://blog.csdn.net/qq_42698608/article/details/104793387

 

相关文章:

  • 2021-07-09
  • 2021-08-29
  • 2021-05-10
  • 2021-09-19
  • 2021-04-21
  • 2022-03-04
  • 2021-11-29
  • 2021-07-17
猜你喜欢
  • 2022-01-19
  • 2021-12-31
  • 2021-12-12
  • 2021-08-22
  • 2022-12-23
  • 2021-12-14
  • 2021-06-10
相关资源
相似解决方案