Pytorch Colab pro不提供超过16 gb的ram

Pytorch Colab pro不提供超过16 gb的ram,pytorch,google-colaboratory,Pytorch,Google Colaboratory,今天我将我的帐户升级到Colab pro。尽管它将ram打印为: Your runtime has 27.3 gigabytes of available RAM You are using a high-RAM runtime! 当我开始训练我的模型时,它给出了下面的错误 RuntimeError: CUDA out of memory. Tried to allocate 88.00 MiB (GPU 0; 15.90 GiB total capacity; 14.75

今天我将我的帐户升级到Colab pro。尽管它将ram打印为:

Your runtime has 27.3 gigabytes of available RAM
    
    You are using a high-RAM runtime!
当我开始训练我的模型时,它给出了下面的错误

RuntimeError: CUDA out of memory. Tried to allocate 88.00 MiB (GPU 0; 15.90 GiB total capacity; 14.75 GiB already allocated; 75.75 MiB free; 14.95 GiB reserved in total by PyTorch)
我的模型的超参数:

args_dict = dict(
    #data_dir="", # path for data files
    output_dir="", # path to save the checkpoints
    model_name_or_path='t5-large',
    tokenizer_name_or_path='t5-large',
    max_seq_length=600,
    learning_rate=3e-4,
    weight_decay=0.0,
    adam_epsilon=1e-8,
    warmup_steps=0,
    train_batch_size=4,
    eval_batch_size=4,
    num_train_epochs=2,
    gradient_accumulation_steps=16,
    n_gpu=1,
    early_stop_callback=False,
    fp_16=True, # if you want to enable 16-bit training then install apex and set this to true
    opt_level='O1', # you can find out more on optimisation levels here https://nvidia.github.io/apex/amp.html#opt-levels-and-properties
    max_grad_norm=1.0, # if you enable 16-bit training then set this to a sensible value, 0.5 is a good default
    seed=42,
)
Colab pro不提供所有ram。我的代码仅在序列\批次\大小=1时有效。这是什么原因?有什么想法吗


注意:当我在Kaggle(16Gb)中运行代码时,会出现相同的错误。那么,我从colab pro中得到了什么?

看看您的错误,16 GB是指图形卡,而不是ram

据我所知,使用colab pro可以使您使用高达16GB VRAM的图形卡

您可以通过运行以下代码来检查VRAM金额

gpu_info = !nvidia-smi
gpu_info = '\n'.join(gpu_info)
if gpu_info.find('failed') >= 0:
  print('Select the Runtime > "Change runtime type" menu to enable a GPU accelerator, ')
  print('and then re-execute this cell.')
else:
  print(gpu_info)

也许您使用的批处理大小小于4?

查看您的错误,16 GB是指图形卡,而不是ram

据我所知,使用colab pro可以使您使用高达16GB VRAM的图形卡

您可以通过运行以下代码来检查VRAM金额

gpu_info = !nvidia-smi
gpu_info = '\n'.join(gpu_info)
if gpu_info.find('failed') >= 0:
  print('Select the Runtime > "Change runtime type" menu to enable a GPU accelerator, ')
  print('and then re-execute this cell.')
else:
  print(gpu_info)

也许您使用的批处理大小小于4?

您好:您使用的数据有多大?你能在这里发布你的代码的一个小例子吗?特别是训练循环,我使用的代码与官方拥抱脸网站上给出的代码相同。我刚刚用RACE数据集替换了SWAG,如Hello:您使用的数据有多重?你能在这里发布你的代码的一个小例子吗?特别是训练循环,我使用的代码与官方拥抱脸网站上给出的代码相同。我刚刚用RACE数据集替换了SWAG,如中所示