随笔分类 -  [T07] Pytorch

摘要:1、情景 pytorch的模型,torch.jit.trace转换成pt文件 然后通过C++加载调用模型; 2、报错内容: terminate called after throwing an instance of 'std::runtime_error' what(): Input and hi 阅读全文
posted @ 2022-06-15 20:24 戒骄戒躁-沉淀积蓄 阅读(333) 评论(0) 推荐(0)
摘要:单例模式以及Python实现 单例模式 单例模式就是确保一个类只有一个实例.当你希望整个系统中,某个类只有一个实例时,单例模式就派上了用场.比如,某个服务器的配置信息存在在一个文件中,客户端通过AppConfig类来读取配置文件的信息.如果程序的运行的过程中,很多地方都会用到配置文件信息,则就需要创 阅读全文
posted @ 2021-06-10 16:11 戒骄戒躁-沉淀积蓄 阅读(92) 评论(0) 推荐(0)
摘要:在迁移学习中我们经常会用到预训练模型,并在预训练模型的基础上添加额外层。训练时先将预训练层参数固定,只训练额外添加的部分。完了之后再全部训练微调。 在pytorch 固定部分参数训练时需要在优化器中施加过滤。 需要自己过滤 optimizer.SGD(filter(lambda p: p.requi 阅读全文
posted @ 2021-01-26 16:28 戒骄戒躁-沉淀积蓄 阅读(1648) 评论(0) 推荐(0)
摘要:1、高版本模型在低版本环境运行Error Traceback (most recent call last): File "demo.py", line 76, in <module> demo(args) File "demo.py", line 45, in demo model.load_st 阅读全文
posted @ 2020-11-13 14:05 戒骄戒躁-沉淀积蓄 阅读(2553) 评论(0) 推荐(0)
摘要:torchtorchvisionpython master / nightly master / nightly >=3.6 1.6.0 0.7.0 >=3.6 1.5.1 0.6.1 >=3.5 1.5.0 0.6.0 >=3.5 1.4.0 0.5.0 ==2.7, >=3.5, <=3.8 1 阅读全文
posted @ 2020-10-14 17:29 戒骄戒躁-沉淀积蓄 阅读(2069) 评论(0) 推荐(0)
摘要:pytorch中transform函数 一般用Compose把多个步骤整合到一起: 比如说 transforms.Compose([ transforms.CenterCrop(10), transforms.ToTensor(), ]) 这样就把两个步骤整合到一起 接下来介绍transforms中 阅读全文
posted @ 2019-11-26 14:38 戒骄戒躁-沉淀积蓄 阅读(541) 评论(0) 推荐(0)