当前位置:网站首页>[fairseq] 报错:TypeError: _broadcast_coalesced(): incompatible function arguments
[fairseq] 报错:TypeError: _broadcast_coalesced(): incompatible function arguments
2022-07-03 04:06:00 【Muasci】
前言
我通过复写了模型的state_dict方法,具体就是给其增加了dynamic_mask(字典类型,里面是tensor),allocated_neuron_num(整型)。
def state_dict(self, destination=None, prefix='', keep_vars=False):
state_dict = super().state_dict(destination, prefix, keep_vars)
state_dict['model.dynamic_mask'] = gloVar.dynamic_mask
state_dict['model.allocated_neuron_num'] = gloVar.allocated_neuron_num
return state_dict
结果报错:
File "/data3/syxu/sparsenmt_exp/sparsenmt/fairseq/fairseq/models/distributed_fairseq_model.py", line 58, in DistributedFairseqModel
wrapped_model = DistributedDataParallel(
File "/data3/syxu/anaconda3/envs/torch18/lib/python3.8/site-packages/torch/nn/parallel/distributed.py", line 580, in __init__
self._sync_params_and_buffers(authoritative_rank=0)
File "/data3/syxu/anaconda3/envs/torch18/lib/python3.8/site-packages/torch/nn/parallel/distributed.py", line 597, in _sync_params_and_buffers
self._distributed_broadcast_coalesced(
File "/data3/syxu/anaconda3/envs/torch18/lib/python3.8/site-packages/torch/nn/parallel/distributed.py", line 1334, in _distributed_broadcast_coalesced
dist._broadcast_coalesced(
TypeError: _broadcast_coalesced(): incompatible function arguments. The following argument types are supported:
1. (process_group: torch._C._distributed_c10d.ProcessGroup, tensors: List[at::Tensor], buffer_size: int, src: int = 0) -> None
解决
不使用报错中显示的DistributedDataParallel。根据文档,这个在fairseq中体现为–ddp-backend参数。
报错时–ddp-backend=pytorch_ddp
(默认),改为legacy_ddp
、no_c10d
都不会再报错。
参考
https://fairseq.readthedocs.io/en/latest/command_line_tools.html
https://blog.csdn.net/j___t/article/details/104368597
边栏推荐
- Recursion: one dimensional linked lists and arrays
- CVPR 2022 | 大連理工提出自校准照明框架,用於現實場景的微光圖像增强
- xrandr修改分辨率與刷新率
- 国产PC系统完成闭环,替代美国软硬件体系的时刻已经到来
- js实现在可视区内,文字图片动画效果
- Intercept string fixed length to array
- [national programming] [software programming - Lecture Video] [zero foundation introduction to practical application]
- Esp32 series (3): GPIO learning (take simple GPIO input and output, ADC, DAC as examples)
- Practical operation of vim
- Xrandr modify resolution and refresh rate
猜你喜欢
2022-07-02:以下go语言代码输出什么?A:编译错误;B:Panic;C:NaN。 package main import “fmt“ func main() { var a =
Interaction free shell programming
Mila, University of Ottawa | molecular geometry pre training with Se (3) invariant denoising distance matching
『期末复习』16/32位微处理器(8086)基本寄存器
Bisher - based on SSM pet adoption center
毕设-基于SSM宠物领养中心
2022 polymerization process examination questions and polymerization process examination skills
pytorch是什么?pytorch是一个软件吗?
【刷题篇】接雨水(一维)
2022-07-02: what is the output of the following go language code? A: Compilation error; B:Panic; C:NaN。 package main import “fmt“ func main() { var a =
随机推荐
[graduation season · aggressive technology Er] Confessions of workers
Nat. Comm. | use tensor cell2cell to deconvolute cell communication with environmental awareness
2022 P cylinder filling examination content and P cylinder filling practice examination video
用户体验五要素
Xrandr modify resolution and refresh rate
SAP UI5 应用开发教程之一百零五 - SAP UI5 Master-Detail 布局模式的联动效果实现明细介绍
2022 tea master (primary) examination questions and tea master (primary) examination question bank
Nodejs Foundation: shallow chat URL and querystring module
Makefile demo
Social phobia of contemporary young people (II)
105. SAP UI5 Master-Detail 布局模式的联动效果实现明细介绍
nodejs基础:浅聊url和querystring模块
pytorch怎么下载?pytorch在哪里下载?
基于Pytorch和RDKit的QSAR模型建立脚本
Competitive product analysis and writing
Basic syntax of class
[Blue Bridge Road - bug free code] pcf8591 - code analysis of AD conversion
[Blue Bridge Road -- bug free code] DS18B20 temperature reading code analysis
[brush questions] most elements (super water king problem)
学会pytorch能干什么?