Python 如何找出你是否有colab pro或没有在colab内?

Python 如何找出你是否有colab pro或没有在colab内?,python,google-colaboratory,Python,Google Colaboratory,这是一个更复杂的问题,但是否有这样做的功能? 我就是找不到关于这个主题的任何文档。 例如,我的用法如下: from google.colab import utils # I made this up colab_pro = utils.colab_is_pro() if colab_pro: # train model with higher settings else: # train model with lower settings 目前,我确实有办法做到这一点,但它相当粗糙:

这是一个更复杂的问题,但是否有这样做的功能? 我就是找不到关于这个主题的任何文档。 例如,我的用法如下:

from google.colab import utils # I made this up
colab_pro = utils.colab_is_pro()
if colab_pro:
  # train model with higher settings
else:
  # train model with lower settings
目前,我确实有办法做到这一点,但它相当粗糙:

gpu_name = !nvidia-smi --query-gpu=gpu_name --format=csv
# You get Tesla T4 with free colab and faster GPUs with colab pro
colab_pro = False if 'T4' in gpu_name else True
仅供参考,这是我正在研究的colab: