- 博客(141)
- 收藏
- 关注
原创 ImportError: cannot import name ‘Qwen2VLForConditionalGeneration‘ from ‘transformers‘
4.44.2版本的 transformer 会有标题的错误。装完版本是 4.45.0.dev0。
2024-09-10 16:28:38 1470
原创 慎用 np.vstack 和 np.hstack
连接2个array,如果是1维数组,要用 np.hstack,2维数组,要用 np.vstack。但可以统一用 np.concatenate(, axis=0)。
2024-06-21 17:06:13 236 1
原创 远程连接 vscode 出错 “远程主机可能不符合 glibc 和 libstdc++ VS Code 服务器的先决条件”
下载 1.85.2,https://update.code.visualstudio.com/1.85.2/win32-x64-archive/stable。vscode 版本是 1.86,服务器上的 glibc 和 libstdc++ 版本不满足。
2024-02-22 15:52:26 1679
原创 在 docker 中安装 sam
3、进入 segment-anything 目录,用 pip install . 安装。1、进入 docker,共享一个主机的目录。2、在主机的目录中做 git clone。
2023-12-15 14:51:12 711 1
原创 “RuntimeError: Unable to find a valid cuDNN algorithm to run convolution“
调小 batch size。
2023-10-26 10:27:01 136
原创 timm 和 torchvision 中的 resnet50
从 timm 和 torchvision 分别加载 resnet50 预训练模型,从 onnx 看,权重是一样的。
2022-11-14 16:50:28 1784 1
原创 torch.autocast 放在 forward 中
使用 DDP时,如果不是 每块 GPU 一个进程,torch.autocast 应该放在 forward 中。
2022-10-09 15:55:13 606
原创 cross entropy loss = log softmax + nll loss
cross entropy loss = log softmax + nll loss
2022-06-07 16:58:43 412
原创 IndexError: shape mismatch: indexing tensors could not be broadcast together with shapes [2], [3]
import torcha = torch.randn(3,5)print(a)# 下行会有错误 IndexError: shape mismatch: indexing tensors could not be broadcast together with shapes [2], [3]#b = a[[0,2],[1,3,4]] # 改成 b = a[[0,2],:][:,[1,3,4]] print(b)输出是:tensor([[ 0.3627, -0.7073, -0.39.
2022-05-09 15:05:27 1936
原创 [8] Assertion failed: dims.nbDims == 4 || dims.nbDims == 5
onnx 转 trt 的时候出现错误:[04/22/2022-15:45:13] [W] [TRT] onnx2trt_utils.cpp:220: Your ONNX model has been generated with INT64 weights, while TensorRT does not natively support INT64. Attempting to cast down to INT32.[04/22/2022-15:45:13] [E] [TRT] (Unnamed
2022-04-22 16:18:55 1804
原创 enforce fail at inline_container.cc:222
执行 torch.load 时出现错误:“RuntimeError: [enforce fail at inline_container.cc:222] . file not found: archive/data/94479765723472”或者“RuntimeError: [enforce fail at inline_container.cc:145] . PytorchStreamReader failed reading file data/94100453134480: inval
2022-04-14 15:54:40 3804 3
原创 使用 trt 的int8 量化和推断 onnx 模型
目录生成 trt 模型1、使用代码2、onnx模型和图片3、修改代码4、结果推断 trt 模型生成 trt 模型1、使用代码https://github.com/rmccorm4/tensorrt-utils.git2、onnx模型和图片模型:动态batch输入(假设为mob_w160_h160.onnx,输入是 [batchsize, 3, 160, 160])。图片:一堆图片(假设有1024张),不需要其他描述文件。在tensorrt-u...
2022-03-27 22:55:41 8605 2
原创 画 ArcFace 中的 margin 曲线
效果如下:代码如下:from math import cos, sin, piimport numpy as npimport matplotlib.pyplot as plt'''# https://github.com/deepinsight/insightface/blob/master/recognition/arcface_torch/losses.pyclass ArcFace(torch.nn.Module): """ ArcFace (https:/..
2022-03-17 20:12:22 536
原创 Unable to determine the device handle for GPU 0000:02:00.0: GPU is lost.
TITAN X (Pascal) 的显卡,当 batch size 过大爆显存时,就会出现 GPU丢失 的错误。
2022-02-17 18:49:51 1185
原创 unhandled system error, NCCL version 2.7.8
在 宿主机上运行基于 DDP 的 pytorch 训练程序没问题,进入 docker 后运行,出现 "unhandled system error, NCCL version 2.7.8" 的错误。解决方法:在 python -m torch.distributed.launch --nproc_per_node=4 ...前加上 NCCL_DEBUG=INFO可以看到:s215:623:649 [3] include/shm.h:48 NCCL WARN Error while cr
2022-02-16 17:58:14 5323 1
原创 在两台 ubuntu 上安装 K8S
参考:1、ubuntu 安装 k8s2、报错:The connection to the server localhost:8080 was refused - did you specify the right host or port?3、Connecting to raw.githubusercontent.com failed: Connection refused. 解决办法安装 flannel 时使用:(python38) ai200@ubuntu16:/$ kubectl
2022-02-15 16:27:35 898
原创 在两台 ubuntu 之间传输大文件
方法1:scp -c aes128-gcm@openssh.coma.tar.gz usrname@ip:dir加上 -c aes128-gcm@openssh.com,可以加速。方法2:rsync -avP a.tar.gz usrname@ip:dir参考:1、linux中scp传文件速度慢原因2、为什么scp这么慢,如何使它更快?...
2022-01-25 10:38:36 1606
原创 ubuntu14.04 升级到 ubuntu16.04
参考:将Ubuntu 16.04 LTS 升级到 18.04 LTS | 以及问题汇总# 升级前(base) root@s215:~# cat /proc/versionLinux version 3.13.0-147-generic (buildd@lcy01-amd64-024) (gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.4) ) #196-Ubuntu SMP Wed May 2 15:51:34 UTC 2018# 升级后(bas
2022-01-24 16:21:20 1143
原创 多机多卡训练时的错误
错误1:“NCCL WARN Connect to failed : Network is unreachable”解决方法:设置环境变量NCCL_SOCKET_IFNAME=enp(有可能是eno,可以先用ifconfig 查看)
2021-12-23 19:51:50 2070 1
原创 onnxruntime-gpu 1.7 出现的警告“Force fallback to CPU execution for node: Gather_191”等
使用 onnxruntime-gpu(简称ORT)1.7 推断 onnx模型时出现如下警告,2021-12-01 15:50:30.792327215 [W:onnxruntime:Default, fallback_cpu_capability.cc:135 GetCpuPreferredNodes] Force fallback to CPU execution for node: Gather_1912021-12-01 15:50:30.792374122 [W:onnxruntime:De
2021-12-01 17:16:00 2436
原创 被 onnx.checker.check_model 检查出的常见错误
错误1:“Field 'name' of graph is required to be non-empty.”解决:对 model.graph.name 赋值。错误2:“Nodes in a graph must be topologically sorted, however input ...”解决:调整节点顺序,保证每个节点的输入都先于它存在。参考代码如下:def check_update_model(model): if (model.graph.name == ''
2021-11-10 17:51:08 5638 2
原创 rearrange 和 einsum 真的优雅吗
结论是,还好吧。从代码量看,差不多:# -*- coding:utf-8 -*-import torchfrom torch import nnfrom torch import einsumfrom einops import rearrangeclass SimpleQKV(nn.Module): def __init__(self, dim, use_ein): super().__init__() self.proj = nn.Linea
2021-11-09 10:59:19 825
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人