OpenBackdoor

Форк
0
/
setup.py 
60 строк · 2.2 Кб
1
import setuptools
2
import os
3
import importlib
4

5
def get_requirements(path):
6
    ret = []
7
    with open(os.path.join(path, "requirements.txt"), encoding="utf-8") as freq:
8
        for line in freq.readlines():
9
            ret.append( line.strip() )
10
    return ret
11

12

13
path = os.path.dirname(os.path.abspath(__file__))
14
requires =  get_requirements(path)
15
print("requirements:")
16
print(requires)
17

18
with open('README.md', 'r') as f:
19
    setuptools.setup(
20
        name = 'openbackdoor',
21
        version = '1.0.0',
22
        description = "An open-scource toolkit for textual backdoor attack and defense.",
23
        long_description=open("README.md", "r", encoding="utf-8").read(),
24
        long_description_content_type="text/markdown",
25
        author = 'Ganqu Cui, Yanyi Chen, Lifan Yuan, Bingxiang He',
26
        author_email = 'cgq19@mails.tsinghua.edu.cn',
27
        license="Apache",
28
        url="https://github.com/cgq15/OpenBackdoor",
29
        keywords = ['PLM', 'AI', 'NLP'],
30
        python_requires=">=3.6.0",
31
        install_requires=requires,
32
        packages=setuptools.find_packages(),
33
        classifiers=[
34
            "Programming Language :: Python :: 3",
35
            "Programming Language :: Python :: 3.8",
36
            "Programming Language :: Python :: 3.9",
37
            "Intended Audience :: Developers",
38
            "Intended Audience :: Education",
39
            "Intended Audience :: Science/Research",
40
            "License :: OSI Approved :: Apache Software License",
41
            "Operating System :: OS Independent",
42
        ]
43
    )
44

45
required_list = ["torch"]
46
for package in required_list:
47
    try:
48
        m = importlib.import_module(package)
49
    except ModuleNotFoundError:
50
        print("\n"+"="*30+"  WARNING  "+"="*30)
51
        print(f"{package} is not found on your environment, please install it manually.")
52
        print("We do not install it for you because the environment sometimes needs special care.")
53

54
optional_list = ["sklearn"]
55
for package in optional_list:
56
    try:
57
        m = importlib.import_module(package)
58
    except ModuleNotFoundError:
59
        print("\n"+"="*30+"  WARNING  "+"="*30)
60
        print(f"{package} is not found on your environment, please install it if the specific script needs.")

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.