当前位置:网站首页>Reproduction process and problems of analog transformer (ICLR 2022 Spotlight)
Reproduction process and problems of analog transformer (ICLR 2022 Spotlight)
2022-07-01 23:28:00 【Mind regulating and alchemy】
The author recommends python3.6,pytorch 1.4
1. Environmental changes
Try installing pytorch 1.4 function , But the code will get stuck , And there's no mistake . The positioning error is :Anomaly-Transformer/model/attn.py
self.distances = torch.zeros((window_size, window_size)).cuda()
.cuda() Get stuck : as a result of Installed pytorch 1.4 Corresponding CUDA Version is 10.x, The power of calculation is sm_86,CUDA 10.x Highest support to sm_75, Therefore need CUDA 11.x To support sm_8.x.
So upgrade My environment python3.7, pytorch 1.12 , The graphics card 3080Ti, CUDA edition :11.3
conda install pytorch torchvision torchaudio cudatoolkit=11.3 -c pytorch
Run the training script again , An error again :
RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation: [torch.cuda.FloatTensor [512, 25]], which is output 0 of AsStridedBackward0, is at version 2; expected version 1 instead. Hint: enable anomaly detection to find the operation that failed to compute its gradient, with torch.autograd.set_detect_anomaly(True).
solve : Comment out Anomaly-Transformer/solver.py One of the first .step():
# Minimax strategy
loss1.backward(retain_graph=True)
# self.optimizer.step()
loss2.backward()
self.optimizer.step()
Reference resources :Why the optimizer.step() write twice? · Issue #8 · thuml/Anomaly-Transformer · GitHub
2. Congratulations ! Running successfully !
python main.py --anormly_ratio 1 --num_epochs 3 --batch_size 128 --mode train --dataset PSM --data_path dataset/PSM --input_c 25 --output_c 25
------------ Options -------------
anormly_ratio: 1.0
batch_size: 128
data_path: dataset/PSM
dataset: PSM
input_c: 25
k: 3
lr: 0.0001
mode: train
model_save_path: checkpoints
num_epochs: 3
output_c: 25
pretrained_model: None
win_size: 100
======================TEST MODE======================
/opt/conda/lib/python3.7/site-packages/torch/nn/_reduction.py:42: UserWarning: size_average and reduce args will be deprecated, please use reduction='none' instead.
warnings.warn(warning.format(ret))
Threshold : 0.002150955616962149
pred: (87800,)
gt: (87800,)
pred: (87800,)
gt: (87800,)
Accuracy : 0.9848, Precision : 0.9713, Recall : 0.9739, F-score : 0.9726
The results in the paper : about PSM Data sets
P: 96.91,R: 98.9, F1: 97.89
Recurring Recall Slightly lower . however Precision Slightly higher . The two need to be weighed . You can adjust the above Threshold : 0.002150955616962149 Balance the two .
边栏推荐
- Redis RDB快照
- STM32F030F4驱动TIM1637数码管芯片
- mt管理器测试滑雪大冒险
- MT manager test skiing Adventure
- "35 years old, the boss of the company, with a monthly salary of 20000, give away takeout": the times abandoned you, not even saying goodbye
- Development trend and future direction of neural network Internet of things
- Redis数据类型和应用场景
- from pip._internal.cli.main import main ModuleNotFoundError: No module named ‘pip‘
- SWT / anr problem - SWT causes kernel fuse deadlock
- 每日三题 6.29
猜你喜欢
Redis~02 cache: how to ensure data consistency in MySQL and redis when updating data?
Notes to problems - file /usr/share/mysql/charsets/readme from install of mysql-server-5.1.73-1 glibc23.x86_ 64 c
学成在线案例实战
Know --matplotlib
from pip._internal.cli.main import main ModuleNotFoundError: No module named ‘pip‘
软件架构的本质
from pip._ internal. cli. main import main ModuleNotFoundError: No module named ‘pip‘
Zhao Fuquan: to ensure supply in the short term, we should build a safe, efficient and resilient supply chain in the long term
Glass mosaic
De PIP. Interne. CLI. Main Import main modulenotfounderror: No module named 'PIP'
随机推荐
Who do you want to know when opening a stock account? Is it safe to open an account online?
ARP报文头部格式和请求流程
from pip._internal.cli.main import main ModuleNotFoundError: No module named ‘pip‘
ShanDong Multi-University Training #3
物联网技术应用属于什么专业分类
SWT / anr problem - SWT causes kernel fuse deadlock
What is the difference between memory leak and memory overflow?
【微服务|Sentinel】SentinelResourceAspect详解
Depth first search and breadth first search of graph traversal
【C#】依赖注入及Autofac
转行软件测试,知道这四点就够了!
Material Design组件 - 使用BottomSheet展现扩展内容(一)
Leetcode (34) -- find the first and last positions of elements in a sorted array
Stm32f030f4 drives tim1637 nixie tube chip
dat. GUI
Zhao Fuquan: to ensure supply in the short term, we should build a safe, efficient and resilient supply chain in the long term
上海炒股开户选择手机办理安全吗?
What professional classification does the application of Internet of things technology belong to
MySQL -- convert rownum in Oracle to MySQL
SWT / anr problem - SWT causes low memory killer (LMK)