当前位置:网站首页>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 pytorchRun 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 .
边栏推荐
- Practical application and extension of plain framework
- jpa手写sql,用自定义实体类接收
- Istio, ebpf and rsocket Broker: in depth study of service grid
- CKS CKA ckad change terminal to remote desktop
- mt管理器测试滑雪大冒险
- 【必会】BM41 输出二叉树的右视图【中等+】
- The digital summit is popular, and city chain technology has triggered a new round of business transformation
- Microservice stability management
- 软件架构的本质
- Matplotlib common charts
猜你喜欢
随机推荐
【微服务|Sentinel】@SentinelResource详解
The difference between timer and scheduledthreadpoolexecutor
Development trend and future direction of neural network Internet of things
CADD course learning (3) -- target drug interaction
Timer和ScheduledThreadPoolExecutor的区别
ShanDong Multi-University Training #3
AirServer最新Win64位个人版投屏软件
物联网应用技术专业是属于什么类
De PIP. Interne. CLI. Main Import main modulenotfounderror: No module named 'PIP'
Matplotlib common settings
神经网络物联网的发展趋势和未来方向
Daily three questions 6.28
转行软件测试,知道这四点就够了!
What are the common types of points mall games?
共享电商的背后: 共创、共生、共享、共富,共赢的共富精神
from pip._internal.cli.main import main ModuleNotFoundError: No module named ‘pip‘
What professional classification does the application of Internet of things technology belong to
Istio, ebpf and rsocket Broker: in depth study of service grid
认识--Matplotlib
Know --matplotlib








