logo
publist
写文章

简介

该用户还未填写简介

擅长的技术栈

可提供的服务

暂无可提供的服务

从0到1基于LangChain和DeepSeek的Agent开发案例(可运行版本)

新建agent虚拟环境(python=3.12.12);建议使用清华镜像安装相关依赖。xxx代表某个库附上博主的版本。

#python
移除预训练网络的全连接层

有时,我们需要利用预训练网络权重提取全连接前的特征。需要将全连接去除掉,然后后面根据自己的任务进行修改。self.feature_extraction = models.resnet34(pretrained=True)self.feature_extraction.fc = nn.Sequential()# remove fc或者,在设计网络层面,将对应的fc去除掉,然后按对应键对进行加载即可。

#python#计算机视觉#神经网络 +2
RuntimeError: Boolean value of Tensor with more than one value is ambiguous

RuntimeError: Boolean value of Tensor with more than one value is ambiguous其中文意思大致是该张量含有多个(1个以上不含1个)boolean值,是不明确的,即无法比较。这里先举一个报错的例子:features = torch.zeros(8, 32)if features[1] == torch.zeros(32): # i

#pytorch
python运行程序设置指定GPU(查看GPU使用情况)

常见的两种使用方式如下:一、python文件里设置指定GPU一般情况:import osos.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID" (保证程序cuda序号与实际cuda序号对应)os.environ['CUDA_VISIBLE_DEVICES'] = "0,1"(代表仅使用第0,1号GPU)单GPU:os.environ["CUDA_VISIBLE

#python#windows#深度学习
RuntimeError: Boolean value of Tensor with more than one value is ambiguous

RuntimeError: Boolean value of Tensor with more than one value is ambiguous其中文意思大致是该张量含有多个(1个以上不含1个)boolean值,是不明确的,即无法比较。这里先举一个报错的例子:features = torch.zeros(8, 32)if features[1] == torch.zeros(32): # i

#pytorch
到底了