python - Google Colab - NotImplementedError
问题描述
我一直在尝试使用以下包,就在我尝试实例化它时,它NotImplementedError:
出现在 Google Colab 中。
问题的完整追溯
<ipython-input-51-9980be5d7f5b> in <module>()
4 test_dataset = MyData(input_tensor_test, target_tensor_test)
5
----> 6 train_dataset = DataLoader(train_dataset, sampler=ImbalancedDatasetSampler(train_dataset),batch_size = BATCH_SIZE,
7 drop_last=True
8 )
1 frames
/content/drive/My Drive/torchsampler/imbalanced.py in __init__(self, dataset, indices, num_samples, callback_get_label)
30 label_to_count = {}
31 for idx in self.indices:
---> 32 label = self._get_label(dataset, idx)
33 if label in label_to_count:
34 label_to_count[label] += 1
/content/drive/My Drive/torchsampler/imbalanced.py in _get_label(self, dataset, idx)
51 return self.callback_get_label(dataset, idx)
52 else:
---> 53 raise NotImplementedError
54
55 def __iter__(self):
NotImplementedError:
我见过类似的解决方案来解决这个问题,但它是在 jupyter notebook 中提出的解决方案包括升级笔记本。
我如何在 Colab 中解决此问题,或者是否有其他替代方法可以在 Colab 上解决此问题?
解决方案
推荐阅读
- r - 物种积累曲线缺失线
- javascript - 尝试将按钮附加到当前幻灯片以在 slick.js 中在它们之间导航
- python - 使用 Python 从不断更新的网页中提取内容
- spring - 在 Spring Security 中使用 DB 身份验证和 SAML 身份验证
- python - 选择非英语布局时,Tkinter 热键绑定不起作用
- image - 为什么我不能在 Tampermonkey 中更改这张图片?
- javascript - Google Chrome 扩展中的 webkitSpeechRecognition
- python - 使用条件 Python 将不同的元素添加到列表中 - 返回一个元组
- python - Import pptx 时出错“ImportError: DLL load failed: The specified procedure could not be found.”
- python - numpy 向量化一个 5x5 数组,但允许在 5x5 数组中所做的任何更改反映在向量中