官方源代码
https://github.com/aimagelab/meshed-memory-transformer
环境:Window11、pytorch1.10.1(老铁们可以试试新的torch,说不定会有精度加成)
参考博客
1、参考博客1:主要解决conda 环境,有些包安装不上去,注释掉。
博客1
2、参考博客2:主要解决安装pycocotools
博客2
个人流程
1、克隆存储库并m2release使用文件创建 conda 环境environment.yml:
这里window有些包装不上去,我选择注释,用PIP install 下载,有些环境包环境是Linux就直接先无视。
conda env create -f environment.yml
conda activate m2release
2、按照流程安装
python -m spacy download en
doownload
3、改改features_path和annotation_folder
parser.add_argument('--features_path', type=str,default="D:\\study\\pytorch\\meshed-memory-transformer-master\\dataset\\feature\\coco_detections.hdf5")
parser.add_argument('--annotation_folder', type=str,default="D:\study\pytorch\meshed-memory-transformer-master\dataset\\annotations")
4、
this is a bug, please fix the code in models/beam_search.py line 118:
# selected_beam = selected_idx / candidate_logprob.shape[-1]
selected_beam = torch.div(selected_idx, candidate_logprob.shape[-1], rounding_mode="floor")
5、会报个警告: attention_mask.bool()
att = att.masked_fill(attention_mask.bool(), -np.inf)
6、ulimit
ulimit 是 Linux 和 Unix 系统中用来设置用户级别资源限制的 shell 命令。通过这个命令,你可以限制用户可以打开的文件数量、可以使用的 CPU 时间、可以占用的内存大小等多种资源。
ulimit -n
对于系统级别的修改,你可能需要修改 /etc/security/limits.conf 文件,并添加类似以下的行
* soft nofile 4096
* hard nofile 4096
7、成功
小结
总结
:糊里糊涂就成功了