Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
AutoAWQ
Commits
7fce4b80
Commit
7fce4b80
authored
Aug 28, 2024
by
gaoqiong
Browse files
根据DCU特性修改部分代码
parent
665a401e
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
9 deletions
+26
-9
README.md
README.md
+7
-0
examples/generate.py
examples/generate.py
+1
-1
requirements.txt
requirements.txt
+2
-1
setup.py
setup.py
+16
-7
No files found.
README.md
View file @
7fce4b80
...
...
@@ -60,8 +60,15 @@ cd dist && pip3 install autoawq*
| Baichuan | 7B/13B |
| QWen | 1.8B/7B/14/72B |
## 验证
-
python -c "import awq; print(awq.
\_\_
version__)",版本号与官方版本同步,查询该软件的版本号,例如0.2.5;
## Known Issue
-
无
## 参考资料
-
[
README
](
README.md
)
-
[
https://github.com/casper-hansen/AutoAWQ
](
https://github.com/casper-hansen/AutoAWQ.git
)
...
...
examples/generate.py
View file @
7fce4b80
...
...
@@ -5,7 +5,7 @@ from transformers import AutoTokenizer, TextStreamer
quant_path
=
"casperhansen/llama-3-8b-instruct-awq"
# Load model
model
=
AutoAWQForCausalLM
.
from_quantized
(
quant_path
,
fuse_layers
=
True
)
model
=
AutoAWQForCausalLM
.
from_quantized
(
quant_path
,
fuse_layers
=
False
,
use_exllama_v2
=
True
)
tokenizer
=
AutoTokenizer
.
from_pretrained
(
quant_path
,
trust_remote_code
=
True
)
streamer
=
TextStreamer
(
tokenizer
,
skip_prompt
=
True
,
skip_special_tokens
=
True
)
...
...
requirements.txt
View file @
7fce4b80
zstandard
transformers
==4.42.3
datasets
\ No newline at end of file
setup.py
View file @
7fce4b80
...
...
@@ -8,6 +8,10 @@ from setuptools import setup, find_packages
from
torch.utils.cpp_extension
import
CUDAExtension
from
typing
import
Optional
,
Union
add_git_version
=
False
if
int
(
os
.
environ
.
get
(
'ADD_GIT_VERSION'
,
'0'
))
==
1
:
add_git_version
=
True
def
get_latest_kernels_version
(
repo
):
"""
Get the latest version of the kernels from the github repo.
...
...
@@ -50,16 +54,21 @@ def get_abi():
def
get_version_add
(
sha
:
Optional
[
str
]
=
None
)
->
str
:
command
=
"git config --global --add safe.directory "
+
pwd
result
=
subprocess
.
run
(
command
,
shell
=
True
,
capture_output
=
False
,
text
=
True
)
version
=
''
autoawq_root
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
add_version_path
=
os
.
path
.
join
(
os
.
path
.
join
(
autoawq_root
,
"awq"
),
"__init__.py"
)
if
add_git_version
:
if
sha
!=
'Unknown'
:
if
sha
is
None
:
sha
=
get_sha
(
autoawq_root
)
version
=
'git'
+
sha
[:
7
]
version
=
'das.opt1.'
+
sha
[:
7
]
else
:
version
=
'das.opt1'
# abi
version
+=
"."
+
get_abi
()
#
version += "." + get_abi()
# dtk version
if
os
.
getenv
(
"ROCM_PATH"
):
...
...
@@ -78,7 +87,7 @@ def get_version_add(sha: Optional[str] = None) -> str:
with
open
(
add_version_path
,
'r'
,
encoding
=
'utf-8'
)
as
file
:
lines
=
file
.
readlines
()
lines
[
1
]
=
"__dcu_version__ = '0.2.5+
das1.1.
{}'
\n
"
.
format
(
version
)
lines
[
1
]
=
"__dcu_version__ = '0.2.5+{}'
\n
"
.
format
(
version
)
with
open
(
add_version_path
,
encoding
=
"utf-8"
,
mode
=
"w"
)
as
file
:
file
.
writelines
(
lines
)
file
.
close
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment