我已经在colab中上传了我的火车和测试文件。
function categorywiseclass(){
if (!$this->ion_auth->logged_in()) {
redirect('auth/login', 'refresh'); // redirect them to the login page
} else {
$id = $this->input->get('id');
$data[] = $this->SectionModel->getSectionByclass($id);
echo json_encode($data);
}
}
我遇到以下错误:
from google.colab import files
uploaded = files.upload()
uploaded.keys()
with open(uploaded['train_qa.txt'], "rb") as fp:
train_data = pickle.load(fp.read())]
我该如何解决?我只想读取colab中的文件。我知道其他解决方法,但是如何解决此错误?
答案 0 :(得分:0)
已上传的内容已映射到字节。
所以:
train_data = pickle.load(uploaded['train_qa.txt'])