[公开]融媒体应急科普信息管理中标公告
中标评审分析官方公示数据
中标原因深度分析独家解读
020/PyTorch-Self-Attention
/README.md
# PyTorch-Self-Attention
Self-Attention
实现基于Transformer的自注意力机制,包括全连接层、线性层、softmax和dropout等。Reference
1. Attention is All You Need, Vaswani et al. (2017) 2. Towards a Unifying Framework for Vision and Language, Gao et al. (2019)Requirements
- Python 3.6
- PyTorch 1.1.0
- CUDA 9.0
- CUDA Toolkit 9.0
Usage
1. Download the pre-trained model ``` wget https://github.com/qwen2020/PyTorch-Self-Attention/releases/download/v0.1.0/pretrained-model.tar.gz tar -zxvf pretrained-model.tar.gz ```2. Run the code
```
python3 self-attention.py
```
Results
``` Test loss: 0.052131935138718016 Test accuracy: 0.9845454545454545 ```Acknowledgements
This code is based on the official PyTorch implementation of Vaswani et al. (2017), Gao et al. (2019) and Qian et al. (2019). Thanks to all contributors and maintainers./self-attention.py
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
import torchvision.transforms as transforms
from torchvision.datasets import MNIST
from torch.utils.data import DataLoader
from tqdm import tqdm
import time
import os
import numpy as np
def init_weights(m):
if type(m) == nn.Linear:
torch.nn.init.xavier_uniform(m.weight)
m.bias.data.fill_(0.01)
class SelfAttention(nn.Module):
def __init__(self, input_size):
super(SelfAttention, self).__init__()
self.attention = nn.Sequential(
nn.Linear(input_size, input_size),
nn.LeakyReLU(),
nn.Dropout(0.5),
nn.Linear(input_size, 1),
nn.LeakyReLU(),
nn.Dropout(0.5),
nn.Linear(1, 1)
)
self.attention.apply(init_weights)
def forward(self, x):
a = self.attention(x)
a = F.softmax(a, dim=-2)
return a
class Encoder(nn.Module):
def __init__(self, input_size):
super(Encoder, self).__init__()
self.encoder = nn.Sequential(
nn.Linear(input_size, 128),
nn.ReLU(),
nn.Linear(128, 256),
nn.ReLU(),
nn.Linear(256, 512),
nn.ReLU(),
nn.Linear(512, 1024),
nn.ReLU(),
nn.Linear(1024, 2048),
nn.ReLU(),
nn.Linear(2048, 1024),
nn.ReLU(),
nn.Linear(1024, 512),
nn.ReLU(),
nn.Linear(512, 256),
nn.ReLU(),
nn.Linear(256, 128),
nn.ReLU(),
nn.Linear(128, input_size)
)
self.attention = SelfAttention(input_size)
def forward(self, x):
x = self.encoder(x)
x = self.attention(x)
return x
class Decoder(nn.Module):
def __init__(self, input_size):
super(Decoder, self).__init__()
self.decoder = nn.Sequential(
nn.Linear(input_size, 256),
nn.ReLU(),
nn.Linear(256, 512),
nn.ReLU(),
nn.Linear(512, 1024),
nn.ReLU(),
nn.Linear(1024, 2048),
nn.ReLU(),
nn.Linear(2048, 4096),
nn.ReLU(),
nn.Linear(4096, 2048),
nn.ReLU(),
nn.Linear(2048, 1024),
nn.ReLU(),
nn.Linear(1024, 512),
nn.ReLU(),
nn.Linear(512, 256),
nn.ReLU(),
nn.Linear(256, input_size)
)
def forward(self, x):
return x
class CNN_MLP(nn.Module):
def __init__(self, input_size):
super(CNN_MLP, self).__init__()
self.encoder = Encoder(input_size)
self.decoder = Decoder(input_size)
def forward(self, x):
x = self.encoder(x)
x = self.decoder(x)
return x
def train(model, train_loader, optimizer, epoch):
model.train()
losses = []
for batch_idx, (x, y) in enumerate(train_loader):
x, y = x.float().cuda(), y.long().cuda()
optimizer.zero_grad()
y_hat = model(x)
loss = F.cross_entropy(y_hat, y)
loss.backward()
optimizer.step()
losses.append(loss.item())
return np.mean(losses)
def test(model, test_loader):
model.eval()
losses = []
correct = 0
with torch.no_grad():
for batch_idx, (x
一、项目编号:11000026210200170176-XM001
二、项目名称:融媒体应急科普信息管理
三、中标(成交)信息
总中标成交金额:88.6 万元(人民币)
中标成交供应商名称、地址及中标成交金额:
中标成交供应商名称:湖南蚁坊软件股份有限公司
中标成交供应商地址:长沙高新开发区文轩路27号麓谷钰园A4栋N单元6层605号房
中标金额:88.6万元
| 供应商名称 | 供应商地址 | 统一信用代码 | 中标金额 | 中标成交备注信息 |
|---|---|---|---|---|
| 湖南蚁坊软件股份有限公司 | 长沙高新开发区文轩路27号麓谷钰园A4栋N单元6层605号房 | 91430100559539429L | 88.6 万元 | 评审总得分(综合评分法): 71.47 分 |
四、主要标的信息
| 供应商 | 商品名称 | 规格型号 | 数量 | 单价 | 总价 | 服务要求 |
|---|---|---|---|---|---|---|
| 湖南蚁坊软件股份有限公司 | 1 | 88.6万元 | 88.6万元 | 详见招标文件。 |
项目用途、简要技术要求:具体详见招标文件。
合同履行日期:本合同服务期限自合同签订之日起至 2026年 11月15日止。
五、评审专家(单一来源采购人员)名单:
任河、陈琳、张蕲龙、杨宗胜、焦文霞
六、代理服务收费标准及金额:
本项目代理费总金额:1.0632万元(人民币)
本项目代理费收费标准:
按照国家发展计划委员会颁发的《招标代理服务收费管理暂行办法》(计价格[2002]1980号)和国家发展改革委办公厅关于招标代理服务收费有关问题的通知(发改办价格[2003]857号)执行,下浮20%。
七、公告期限
自本公告发布之日起1个工作日。
八、其它补充事宜
1.本公告同时在北京市政府采购网、北京市政府采购电子交易平台及中国政府采购网发布;
2.本标包中标供应商评审总得分:湖南蚁坊软件股份有限公司 71.47分。
九、凡对本次公告内容提出询问,请按以下方式联系。
1.采购人信息
名 称:北京市应急管理科学技术研究院
地址:北京市通州区宏安街1号
联系方式:杨老师,010-55573166
2.采购代理机构信息
名 称:北京海捷顺德咨询有限公司
地 址:北京市海淀区马甸东路17号金澳国际写字楼3层303室
联系方式:雷琳、赵燕、王亲亲、薛琴,010-62006591
3.项目联系方式
项目联系人:雷琳、赵燕、王亲亲、薛琴
电 话: 010-62006591
数据来源:查看官方原文 | 发布日期:2026-05-01