-
Notifications
You must be signed in to change notification settings - Fork 168
Expand file tree
/
Copy pathsetup.py
More file actions
57 lines (46 loc) · 1.61 KB
/
setup.py
File metadata and controls
57 lines (46 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#! -*- coding: utf-8 -*-
import os
from setuptools import setup, find_packages
import re
from typing import List
with open("README.md", "r", encoding='utf-8') as fh:
long_description = fh.read()
def get_version() -> str:
with open(os.path.join("bert4torch", "cli.py"), encoding="utf-8") as f:
file_content = f.read()
pattern = r"{}\W*=\W*\"([^\"]+)\"".format("VERSION")
version = re.findall(pattern, file_content)[0]
return version
def get_requires() -> List[str]:
with open("requirements.txt", encoding="utf-8") as f:
file_content = f.read()
lines = [line.strip() for line in file_content.strip().split("\n") if not line.startswith("#")]
return lines
def get_console_scripts() -> List[str]:
console_scripts = [
"bert4torch = bert4torch.cli:main",
"b4t = bert4torch.cli:main"
]
return console_scripts
extra_require = {
"transformers": ["transformers"],
"accelerate": ["accelerate"],
"deepspeed": ["deepspeed>=0.10.0,<=0.16.5"],
"trl": ["trl"],
"peft": ["peft"]
}
setup(
name='bert4torch',
version=get_version(),
author="Tongjilibo",
author_email="tongjilibo@163.com",
description='an elegant bert4torch',
long_description=long_description,
long_description_content_type="text/markdown",
license='MIT Licence',
url='https://github.com/Tongjilibo/bert4torch',
install_requires=get_requires(),
extras_require=extra_require,
packages=find_packages(),
entry_points={"console_scripts": get_console_scripts()},
)