This repository has been archived by the owner on Mar 2, 2024. It is now read-only.
forked from TorchEI/TorchEI
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'TorchEI:main' into main
- Loading branch information
Showing
45 changed files
with
9,227 additions
and
1,568 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Doc | ||
on: [push] | ||
jobs: | ||
doc-deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@master | ||
|
||
- name: api-generate | ||
run: | | ||
sed -i 's/\[中文\](.\/README-zh.md)/ /' README.md | ||
cp README.md ./docs/index.md | ||
cp README-zh.md ./docs/zh/index.md | ||
pip3 install pydoc-markdown torchei | ||
pip3 install typing-extensions==3.10.0.2 | ||
echo '# API Reference' > docs/api.md | ||
sed -i 's/**kwargs,/**kwargs/' torchei/fault_model.py | ||
more torchei/fault_model.py | ||
pydoc-markdown -p torchei '{renderer:{type: markdown,descriptive_class_title: false,render_toc: false, header_level_by_type: { Module: 2, Class: 2, Method: 3, Function: 3} } }' > temp.md | ||
sed -n '1,3p;6,9999p' temp.md >> docs/api.md | ||
echo '> Auto Generated by pydoc-markdown' >> docs/api.md | ||
ls -lR | ||
- name: vuepress-deploy | ||
uses: jenkey2011/vuepress-deploy@master | ||
env: | ||
ACCESS_TOKEN: ${{ secrets.REPO_TOKEN }} | ||
TARGET_BRANCH: gh-pages | ||
BUILD_SCRIPT: yarn && yarn docs:build | ||
BUILD_DIR: docs/.vuepress/dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: sync-gitee | ||
on: | ||
push: | ||
branches: | ||
- main | ||
jobs: | ||
repo-sync: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Mirror the Github organization repos to Gitee. | ||
uses: Yikun/hub-mirror-action@master | ||
with: | ||
src: 'github/TorchEI' | ||
dst: 'gitee/TorchEI' | ||
dst_key: ${{ secrets.SSH_PRIVATE_KEY }} | ||
dst_token: ${{ secrets.GITEE_PRIVATE_KEY }} | ||
static_list: "TorchEI" | ||
account_type: org | ||
force_update: true | ||
debug: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
cff-version: 1.0.0 | ||
message: "If this repo helped you, please cite it as below." | ||
authors: | ||
- family-names: "Zheng" | ||
given-names: "Hao" | ||
title: "TorchEI" | ||
version: 1.0.0 | ||
date-released: 2022-5-24 | ||
url: "https://github.com/TorchEI/TorchEI" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
<div align="center"> | ||
<img src="https://raw.githubusercontent.com/TorchEI/TorchEI/main/assets/torchei.svg" alt="torchei_logo" align="center" style="width:30%;" /> | ||
</div> | ||
|
||
<h1 style = "margin:0;" align="center">TorchEI⚡</h1> | ||
|
||
<div align = "center" style="font-weight: bold;"><a href="#introduction">Intro</a> ● <a href="#quick-example">Usage</a> ● <a href="https://TorchEI.github.com.io/TorchEI/">Doc</a> ● <a href="#citation">Cite</a> ● <a href="#contribution" >Contribution</a> ● <a href="#license">License</a></div> | ||
|
||
------ | ||
|
||
<div align = "center"> | ||
<a href = "https://github.com/TorchEI/TorchEI/actions/workflows/pytest-cov.yml"> | ||
<img src="https://github.com/TorchEI/TorchEI/actions/workflows/pytest-cov.yml/badge.svg"/></a> | ||
<a href = "https://github.com/TorchEI/TorchEI/actions/workflows/doc-deploy.yml"> | ||
<img src="https://github.com/TorchEI/TorchEI/actions/workflows/doc-deploy.yml/badge.svg"/></a> | ||
<a href="https://codecov.io/gh/TorchEI/TorchEI" > | ||
<img src="https://codecov.io/gh/TorchEI/TorchEI/branch/main/graph/badge.svg?token=0ADLQFHLCJ"/></a> | ||
<a href="https://www.codacy.com/gh/TorchEI/TorchEI/dashboard?utm_source=github.com&utm_medium=referral&utm_content=TorchEI/TorchEI&utm_campaign=Badge_Grade"> | ||
<img src="https://app.codacy.com/project/badge/Grade/c4067d004b934d49bb4386b650c57808"/></a> | ||
<a href="https://pypi.org/project/torchei/" target=”_blank”> | ||
<img src="https://img.shields.io/pypi/v/torchei" alt="Pypi"></a> | ||
<a href="https://pypi.org/project/torchei/" target=”_blank”> | ||
<img src="https://pepy.tech/badge/torchei"/></a> | ||
<a href="#license"> | ||
<img src="https://img.shields.io/github/license/torchei/torchei" alt="License"></a> | ||
</div> | ||
|
||
|
||
## Introduction | ||
|
||
👋TorchEI, 发音为*/ˈtôrCHər/*(like torture), 是Pytorch Error Injection的缩写, 一个围绕DNN Reliability 研究的高速工具箱. TorchEI 使您能够快速简单地将错误注入 DNN,收集您需要的信息并强化您的 DNN。 | ||
|
||
|
||
## Features | ||
|
||
- 完善的类型提示和文档支持 | ||
- 包含来自 DNN 可靠性论文的方法 | ||
- 高度定制化 | ||
|
||
## Quick Example | ||
|
||
在这里,我们将向您展示一个简单的示例,或者您可以尝试 [interactive demo](https://colab.research.google.com/github/TorchEI/TorchEI/blob/main/example.ipynb) 和[online editor](https://github.dev/TorchEI/TorchEI) | ||
|
||
#### Installing | ||
|
||
你可以使用 `pip3 install torchei` 安装或 [下载](https://github.com/TorchEI/TorchEI/archive/refs/heads/main.zip) | ||
|
||
#### Example | ||
|
||
初始化故障模型 | ||
|
||
```python | ||
import torch | ||
from torchvision import models | ||
import torchei | ||
model = models.resnet18(pretrained=True) | ||
data = torch.load('data/ilsvrc_valid8.pt') | ||
fault_model = torchei.fault_model(model,data) | ||
``` | ||
|
||
使用emat方法计算可靠性 | ||
|
||
```python | ||
fault_model.emat_attack(10,1e-3) | ||
``` | ||
|
||
使用[SERN](https://dl.acm.org/doi/abs/10.1145/3386263.3406938)方法计算可靠性 | ||
|
||
```python | ||
fault_model.sern_calc(output_class=1000) | ||
``` | ||
|
||
使用ODR方法加固DNN | ||
|
||
```python | ||
fault_model.outlierDR_protection() | ||
fault_model.emat_attack(10,1e-3) | ||
``` | ||
|
||
## Contribution | ||
|
||
![contributors](https://img.shields.io/github/contributors/torchei/torchei) | ||
|
||
如果您发现🧐任何错误或有🖐️任何建议,请告诉我们。 | ||
|
||
这个 repo 欢迎所有想要一起维护的人。 | ||
|
||
You can helps us with follow things: | ||
|
||
- PR your implemented methods in your or others' papers | ||
- Complete our project | ||
- Translate our docs to your language | ||
- Other | ||
|
||
我们希望将 TorchEI 构建为 DNN 可靠性方面的最佳工具箱,用于位翻转、对抗性攻击等。 | ||
|
||
:e-mail: forcessless@foxmail.com | ||
|
||
## Citation | ||
|
||
Our paper is under delivering. | ||
|
||
## License | ||
|
||
> [MIT](https://github.com/TorchEI/TorchEI/blob/main/LICENSE) License. | ||
> Copyright:copyright:2022/5/23-present, Hao Zheng. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.