Installation
You can install GenoArmory using pip:
pip install genoarmory
Quick Start
# Initialize model
from GenoArmory import GenoArmory
import json
# You need to initialize GenoArmory with a model and tokenizer.
# For visualization, you don't need a real model/tokenizer, so you can use None if the method doesn't use them.
gen = GenoArmory(model=None, tokenizer=None)
params_file = '/projects/p32013/DNABERT-meta/scripts/PGD/pgd_dnabert.json'
# Visulization
gen.visualization(
folder_path='/projects/p32013/DNABERT-meta/BERT-Attack/results/meta/test',
output_pdf_path='/projects/p32013/DNABERT-meta/BERT-Attack/results/meta/test'
)
# Attack
if params_file:
try:
with open(params_file, "r") as f:
kwargs = json.load(f)
except json.JSONDecodeError as e:
raise ValueError(f"Invalid JSON in params file '{params_file}': {e}")
except FileNotFoundError:
raise FileNotFoundError(f"Params file '{params_file}' not found.")
gen.attack(
attack_method='pgd',
model_path='magicslabnu/GERM',
**kwargs
)
Command Line Usage
GenoArmory can also be used from the command line:
# Attack
python GenoArmory.py --model_path magicslabnu/GERM attack --method pgd --params_file /projects/p32013/DNABERT-meta/scripts/PGD/pgd_dnabert.json
# Defense
python GenoArmory.py --model_path magicslabnu/GERM defense --method at --params_file /projects/p32013/DNABERT-meta/scripts/AT/at_pgd_dnabert.json
# Visualization
python GenoArmory.py --model_path magicslabnu/GERM visualize --folder_path /projects/p32013/DNABERT-meta/BERT-Attack/results/meta/test --save_path /projects/p32013/DNABERT-meta/BERT-Attack/results/meta/test/frequency.pdf
# Read MetaData
python GenoArmory.py --model_path magicslabnu/GERM read --type attack --method TextFooler --model_name dnabert
Features
-
Multiple attack methods:
- BERT-Attack
- TextFooler
- PGD
- FIMBA
-
Defense methods:
- ADFAR
- FreeLB
- Traditional Adversarial Training
-
Visualization tools
-
Artifact management
-
Batch processing
-
Command-line interface
Documentation
For detailed documentation, visit [docs](We will release soon).
License
This project is licensed under the MIT License.
Citation
If you have any question regarding our paper or codes, please feel free to start an issue.
If you use GenoArmory in your work, please kindly cite our paper:
Metadata
Release files for genoarmory 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| genoarmory-0.1.0.tar.gz | 3.8 kB | Without provenance | Details for genoarmory-0.1.0.tar.gz |
Release files / genoarmory-0.1.0.tar.gz
| Download URL | genoarmory-0.1.0.tar.gz |
|---|---|
| Size | 3.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8afb8fda31ee3e924f7ab9908fbc66dc5d156d06fca3c437ad976337951e2073
|
|
BLAKE2b-256 checksum How to use checksums |
7a24f3a4bbac0833b88b65a4aa5c4757f65909bd9a991d8468898bf87840c79a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.20
|
Security for genoarmory 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.