当前位置: 首页 > news >正文

小bugs搜集和解决方法,亲测有效(2022-2023)

有些小bugs几行指令就能解决,写太多不好,这里就进行一个2022-2023这段时间的bugs collection和solution。

Deep Learning

How to make really empty tensor?

a = nn.Torch([])
b = torch.empty(2,3)
for i in rang(3):a = torch.cat(a, b, dim=0)

Mismatched attribute type in ’ : value’ ==> Context: Bad node spec for node. Name: OpType: Constant

pip uninstall onnx; pip install onnx==1.11

参考:
onnx
Try running yolov3_onnx sample

Can’t pickle local object 'MiniImagenet.init..

windows不支持:
No, it is not supported on Windows. The reason is that multiprocessing lib doesn’t have it implemented on Windows. There are some alternatives like dill that can pickle more objects.
类似问题:

Can’t pickle local object ‘DataLoader.__init__.<locals>.<lambda>'

参考资料:
Can’t pickle local object ‘DataLoader.init..’

Python 3.11 + pytorch in win11 has error

Use python 3.10.

Freeze layer bugs

Model.named_parameters()会忽略掉一些参数,比如:

Conv1.Bn.running_mean
Conv1.Bn.running_var 
Conv1.Bn.num_batches_tracked

解决方法,用model.state_dict():

for k, v in model.state_dict().items():print kprint type(v)

参考资料:
Model.named_parameters() will lose some layer modules

Python

Import “imgaug.augmenters” could not be resolved PylancereportMissingImports

解决方法:

conda install imgaug

Cannot import name ‘_registerMatType’ from ‘cv2.cv2’ #1494

在cmd等命令窗口卸载imagua。Uninstall imagua in user folder by cmd.

pip uninstall imagua

The frame append method is deprecated use pandas.concat instead

self.F1ScoreDF = self.F1ScoreDF.append(pd.DataFrame(TCnn.F1Score).T)

改成

self.F1ScoreDF = pd.concat([self.F1ScoreDF, pd.DataFrame(TCnn.F1Score).T])

set_yticks does not show up

Map类型的数据不要用来做label。It is nothing about figure size, but just the label names are stored by map object, which is illegal.

ax.set_yticks(np.arange(data.shape[0]), labels=ClassNames)ClassNames = map(str.upper, opt.class_names)
to
ClassNames = list(map(str.upper, opt.class_names))

Anaconda

OMP: Error #15: Initializing libiomp5md.dll, but found libiomp5md.dll already initialized.

OMP: Hint This means that multiple copies of the OpenMP runtime have been linked into the program. That is dangerous, since it can degrade performance or cause 
incorrect results. The best thing to do is to ensure that only a single OpenMP runtime is linked into the process, e.g. by avoiding static linking of the OpenMP runtime in any library. As an unsafe, unsupported, undocumented workaround you can set the environment variable KMP_DUPLICATE_LIB_OK=TRUE to allow the program 
to continue to execute, but that may cause crashes or silently produce incorrect results. For more information, please see http://www.intel.com/software/products/support/.

解决方法:
将mkl在anaconda得navigator删除。
remove mkl in anaconda navigator。

Anaconda libstdc++.so.6: version `GLIBCXX_3.4.20’ not found

conda update libstdcxx-ng

参考资料:
Anaconda libstdc++.so.6: version `GLIBCXX_3.4.20’ not found

sklearn for conda

conda install -c conda-forge scikit-learn

GitHub

fatal: unable to access Connection was reset in connection to github.com:443

git config --global --get http.proxy

参考:
Getting Git to work with a proxy server - fails with “Request timed out”

! [remote rejected] main -> main (Internal Server Error)

 ! [remote rejected] main -> main (Internal Server Error)
error: failed to push some refs to 'https://github.com/anthonyweidai/Advanced_SPL_Classification.git'

解决方法:

git config --bool core.bare true

参考:
Git push error ‘[remote rejected] master -> master (branch is currently checked out)’

fatal: this operation must be run in a work tree

git config --unsetcore.bare

参考:
[FIXED] fatal: this operation must be run in a work tree

The term ‘conda’ is not recognized as the name of a cmdlet

The term 'conda' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again

解决方法:
Add

S:\ProgramData\Anaconda3
S:\ProgramData\Anaconda3\Scripts
S:\ProgramData\Anaconda3\Library\bin

to environment.
Or install anaconda with adding path environment option.
Reboot computer.

conda init powershell
conda init cmd.exe

Git upper case lower case

git config --global core.ignorecase false

参考资料:
How do you change the capitalization of filenames in Git?

Others

the system cannot find the path specified

Click the file inside the zip, and then unzip inside files directly.

‘npm’ is not recognized as an internal or external command

下载Nodejs,download Nodejs.

http://www.lryc.cn/news/159893.html

相关文章:

  • 归并排序和快速排序的两种实现
  • C#,《小白学程序》第十四课:随机数(Random)第一,几种随机数的计算方法与代码
  • [杂谈]-快速了解Modbus协议
  • WhatsApp的两个商业模式该如何选择
  • 动态表单设计
  • JAR will be empty - no content was marked for inclusion!
  • 软件生命周期及流程【软件测试】
  • 2023高教社杯数学建模E题思路代码 - 黄河水沙监测数据分析
  • 双翌保养码使用指南方法(一)
  • hive指定字段插入数据,包含了分区表和非分区表
  • 浏览器端vscode docker搭建(附带python环境)
  • Echarts图表跟随父容器的变化自适应
  • 【多线程】ThreadLocal是什么?有哪些使用场景?使用ThreadLocal需要注意些什么?
  • 一种基于动态代理的通用研发提效解决方案
  • 【vue3】一些关于hooks的使用经验
  • 面试系列 - Java 并发容器详解
  • 使用动态住宅代理还能带来哪些好处?
  • 笙默考试管理系统-MyExamTest----codemirror(18)
  • TGA格式文件转材质
  • IP应用场景查询API:深入了解网络用户行为的利器
  • docker从零部署jenkins保姆级教程(上)
  • 2023数模A题——定日镜场的优化问题
  • Container is running beyond memory limits
  • Java后端开发面试题——JVM虚拟机篇
  • SpringMVC增删改查(CRUD)的实现
  • 智安网络|面临日益增长的安全威胁:云安全和零信任架构的重要性
  • JVM常用调优策略
  • 自动化防火墙放行目标域名IP
  • 12.2RAC环境从RAC转为单机模式的问题处理
  • Docker 中 jdk8容器里无法使用 JDK 的 jmap 等命令的问题