每天实验问题&问题解决思路记录


摘要:每日实验问题&问题解决思路记录

1.pycharm直接运行ipynb(jupyter notebook的文件)简单方法

第一步:shift + 右键(在此处打开powershell)
第二步:jupyter nbconvert --to script *.ipynb

2. 使用pycharm在本地调试运行服务器上的文件

第一步:上传
第二步:设置远程python解释器
第三步:链接 本地文件 = 远程文件
第四步: 运行run

详细链接参考:https://blog.csdn.net/xiangduixuexi/article/details/112210228

3. 报错:Missing optional dependency ‘xlrd‘. Install xlrd >= 1.0.0 for Excel support

安装xlrd的库:pip install xlrd

4. Pycharm导入外部文件标红

  • 右击你的目录名,点击“Mark Directory As” —> “Sources Root”
  • 路径为:问题py文件的上一级目录
  • 详细见图(evaluate.py文件标红、gnn_with_args.py为外部导入文件、code文件夹将被设置为根目录)
    每天实验问题&问题解决思路记录_第1张图片

5.

报错信息

IndexError: invalid index of a 0-dim tensor. Use `tensor.item()` in Python or `tensor.item<T>()`

解决方案:将data[0] 修改成item()

参考文档:https://blog.csdn.net/weixin_44558721/article/details/126388239

日期5月22日

6.

报错信息

Some weights of BertGenerationDecoder were not initialized from the model checkpoint at google/bert_for_seq_generation_L-24_bbc_encoder and are newly initialized: ['lm_head.bias'] You should probably TRAIN this model on a down-stream task to be able to us

解决方案:隐藏warning信息

from transformers import logging

logging.set_verbosity_warning()

参考文档:https://blog.csdn.net/Obolicaca/article/details/123336942

7.

报错信息

Couldn‘t open shared file mapping: <000001910A228862>, error code:1455

解决方案:取消多进程处理

num_workers = 0 

参考文档:https://blog.csdn.net/weixin_43135178/article/details/118511087

8.python可变数据类型

参考:https://blog.csdn.net/qq_46283664/article/details/131756072

你可能感兴趣的:(研究生入门,python,pycharm)