在Google协作中,我获得了IOPub数据速率

时间:2018-06-04 22:48:06

标签: google-colaboratory

超出IOPub数据速率。 笔记本服务器将暂时停止发送输出 到客户端以避免崩溃。 要更改此限制,请设置config变量 --NotebookApp.iopub_data_rate_limit

当前值:

NotebookApp.iopub_data_rate_limit=1000000.0 (bytes/sec)
NotebookApp.rate_limit_window=3.0 (secs)

4 个答案:

答案 0 :(得分:2)

当您尝试向控制台打印大量数据时,通常会发生IOPub错误。检查您的打印语句-如果您尝试打印超过10MB的文件,则很可能会导致错误。尝试读取文件/数据的较小部分。

从Google云端硬盘向Colab读取文件时遇到了此问题。 我使用了此链接https://colab.research.google.com/notebook#fileId=/v2/external/notebooks/io.ipynb 问题出在这段代码

# Download the file we just uploaded.
#
# Replace the assignment below with your file ID
# to download a different file.
#
# A file ID looks like: 1uBtlaggVyWshwcyP6kEI-y_W3P8D26sz
file_id = 'target_file_id'

import io
from googleapiclient.http import MediaIoBaseDownload

request = drive_service.files().get_media(fileId=file_id)
downloaded = io.BytesIO()
downloader = MediaIoBaseDownload(downloaded, request)
done = False
while done is False:
  # _ is a placeholder for a progress object that we ignore.
  # (Our file is small, so we skip reporting progress.)
  _, done = downloader.next_chunk()

downloaded.seek(0)

#Remove this print statement
#print('Downloaded file contents are: {}'.format(downloaded.read()))

我不得不删除最后一个打印语句,因为它超出了笔记本计算机的10MB限制-print('Downloaded file contents are: {}'.format(downloaded.read()))
您的文件仍将被下载,您可以以较小的块读取文件或读取文件的一部分。

答案 1 :(得分:1)

以上答案是正确的,我只是评论了打印语句,错误消失了。只是将其保存在此处,以便有人可能会觉得有用。假设您正在从Google驱动器读取csv文件,只需导入熊猫并添加pd.read_csv(已下载),它将正常工作。

file_id = 'FILEID'

import io
from googleapiclient.http import MediaIoBaseDownload

request = drive_service.files().get_media(fileId=file_id)
downloaded = io.BytesIO()
downloader = MediaIoBaseDownload(downloaded, request)
done = False
while done is False:
  # _ is a placeholder for a progress object that we ignore.
  # (Our file is small, so we skip reporting progress.)
  _, done = downloader.next_chunk()

downloaded.seek(0)
pd.read_csv(downloaded);

答案 2 :(得分:0)

也许这会有所帮助。

来自sv1997

IOPub Error on Google Colaboratory in Jupyter Notebook

IoPub Error is occurring in Colab because you are trying to display the output on the console itself(Eg. print() statements) which is very large.

IoPub错误可能与打印功能有关。

因此删除或注释打印功能。它可以解决错误。

答案 3 :(得分:0)

%cd darknet
!sed -i 's/OPENCV=0/OPENCV=1/' Makefile
!sed -i 's/GPU=0/GPU=1/' Makefile
!sed -i 's/CUDNN=0/CUDNN=1/' Makefile
!sed -i 's/CUDNN_HALF=0/CUDNN_HALF=1/' Makefile
!apt update
!apt-get install libopencv-dev

更新你的make文件很重要。并且,保持您输入的文件名正确