小编Sam*_*hal的帖子

无法在 Pytorch 版本 1.5.1 中加载在 Pytotch 版本 1.6.0 上训练的模型

我最近在1.6.0本地机器上更新了我的 Pytorch 版本以使用他们的混合精度训练,从那时起我遇到了这个问题,我尝试了这里提到的解决方案,但它仍然抛出以下错误。

RuntimeError: version_ <= kMaxSupportedFileFormatVersion INTERNAL ASSERT FAILED at /opt/conda/conda-bld/pytorch_1591914880026/work/caffe2/serialize/inline_container.cc:132, please report a bug to PyTorch. Attempted to read a PyTorch file with version 4, but the maximum supported version for reading is 3. Your PyTorch installation may be too old.

Run Code Online (Sandbox Code Playgroud)

重现链接:https://www.kaggle.com/rohitsingh9990/error-reducing-code ?scriptVersionId=37468859

任何帮助将不胜感激,提前致谢。

python-3.x pytorch kaggle

5
推荐指数
1
解决办法
6639
查看次数

具有多索引的 Pandas 数据透视表小计

我正在尝试创建一个带有小计、Excel 风格的简单数据透视表,但是我找不到使用 Pandas 的方法。我已经尝试了韦斯在另一个与小计相关的问题中建议的解决方案,但这并没有给出预期的结果。下面是重现它的步骤:

创建样本数据:

sample_data = {'customer': ['A', 'A', 'A', 'B', 'B', 'B', 'A', 'A', 'A', 'B', 'B', 'B'], 'product': ['astro','ball','car','astro','ball', 'car', 'astro', 'ball', 'car','astro','ball','car'],
'week': [1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2],
'qty': [10, 15, 20, 40, 20, 34, 300, 20, 304, 23, 45, 23]}

df = pd.DataFrame(sample_data)
Run Code Online (Sandbox Code Playgroud)

创建带有边距的数据透视表(它只有总计,没有客户 (A, B) 的小计)

piv = df.pivot_table(index=['customer','product'],columns='week',values='qty',margins=True,aggfunc=np.sum)

    week           1    2   All
customer    product         
A   astro         10    300 310
    ball          15    20  35
    car           20    304 …
Run Code Online (Sandbox Code Playgroud)

python pivot-table pandas pandas-groupby

4
推荐指数
1
解决办法
3004
查看次数