-
Notifications
You must be signed in to change notification settings - Fork 449
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support building docker image manually in CI #822
Closed
Closed
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
9a46c69
update
9726ae6
add testcase
e85453c
enable test functions
RunningLeon 8ba4da8
update host
e503119
fix error
5e07ebd
update
26c1604
update
57e5a22
find the result
21df7c1
find the result
5634f11
find the result
4d31649
find the result
37347d0
find the result
3155871
find the result
5d31939
find the result
3fc6da4
find the result
c621faf
update
7f42d81
update
590309e
fix build error
c543dfd
fix build error
21f30f9
fix
e402203
update
a183d9d
update
591fb80
update
d09fe5e
fix pr issue
3609d12
fix typo
bc59a0e
fix name typo
57b4889
remove
a2868be
fix typo
db9559a
fix qwen
RunningLeon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
identity_case: | ||
- 你好,你叫什么名字#hi, what's your name: | ||
|
||
memory_test: | ||
- 介绍成都的景点#please introduce some attractions in Chengdu: | ||
- contain: | ||
- chengdu | ||
- 成都 | ||
- contain: | ||
- 熊猫 | ||
- panda | ||
- 介绍美食#please introduce some delicious foods: | ||
- contain: | ||
- 成都 | ||
- chengdu | ||
- contain: | ||
- 火锅 | ||
- hotpot | ||
- hot pot | ||
new_session_without_memory: | ||
- 介绍成都的景点#please introduce some attractions in Chengdu: | ||
- contain: | ||
- chengdu | ||
- 成都 | ||
- end: | ||
- 介绍美食#please introduce some delicious foods: | ||
- not_contain: | ||
- 成都 | ||
- chengdu | ||
chinese_poem_case: | ||
- 给我一首中文打油诗,需要添加标点符号。和,Give me a Chinese poem in Chinese: | ||
- contain: | ||
- "," | ||
- "。" | ||
- 油 | ||
- len_g: | ||
10 | ||
english_poem_case: | ||
- write a romantic poem: | ||
- contain: | ||
- "," | ||
- contain: | ||
- "." | ||
- contain: | ||
- love | ||
- len_g: | ||
100 | ||
emoji_case: | ||
- 你能输出👍的emoji么#Can you output the emoji of 👍: | ||
- contain: | ||
- 👍 | ||
- 😊 | ||
traditional_chinese_case: | ||
- 請介紹香港維多利亞港,用繁體中文回答: | ||
- contain: | ||
- 維多利亞港 | ||
- 维多利亚港 | ||
- victoria | ||
session_len_error: | ||
- 这是很长的一段话这是很长的一段话这是很长的一段话这是很长的一段话这是很长的一段话: | ||
- contain: | ||
- exceed session max length. | ||
- contain: | ||
- Please end the session. |
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,23 @@ | ||
model_path: /nvme/qa_test_models | ||
dst_path: /nvme/qa_test_models/autotest_model | ||
log_path: /nvme/qa_test_models/autotest_model/log | ||
gradio_log_path: /lmdeploy/autotest/gradiotest | ||
|
||
|
||
model_map: | ||
llama2-chat-7b-w4: llama2 | ||
internlm-chat-7b: internlm-chat-7b | ||
internlm-chat-20b: internlm-chat-20b | ||
internlm-chat-20b-inner-w4: internlm-chat-20b | ||
Qwen-7B-Chat: qwen-7b | ||
Qwen-7B-Chat-inner-w4: qwen-7b | ||
Qwen-14B-Chat: qwen-14b | ||
Qwen-14B-Chat-inner-w4: qwen-14b | ||
Baichuan2-7B-Chat: baichuan2-7b | ||
Baichuan2-7B-Chat-inner-w4: baichuan2-7b | ||
CodeLlama-7b-Instruct-hf: codellama | ||
CodeLlama-7b-Instruct-hf-inner-w4: codellama | ||
Llama-2-7b-chat-hf: llama2 | ||
Llama-2-7b-chat-hf-inner-w4: llama2 | ||
llama-2-7b-chat: llama2 | ||
llama-2-7b-chat-inner-w4: llama2 |
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,42 @@ | ||
import os | ||
|
||
import pytest | ||
import yaml | ||
|
||
|
||
@pytest.fixture(scope='session') | ||
def config(request): | ||
config_path = os.path.join(request.config.rootdir, 'config.yaml') | ||
print(config_path) | ||
with open(config_path) as f: | ||
env_config = yaml.load(f.read(), Loader=yaml.SafeLoader) | ||
return env_config | ||
|
||
|
||
@pytest.fixture(scope='session') | ||
def case_config(request): | ||
case_path = os.path.join(request.config.rootdir, 'chat_prompt_case.yaml') | ||
print(case_path) | ||
with open(case_path) as f: | ||
case_config = yaml.load(f.read(), Loader=yaml.SafeLoader) | ||
return case_config | ||
|
||
|
||
@pytest.fixture(scope='class', autouse=True) | ||
def restful_case_config(request): | ||
case_path = os.path.join(request.config.rootdir, | ||
'restful_prompt_case.yaml') | ||
print(case_path) | ||
with open(case_path) as f: | ||
case_config = yaml.load(f.read(), Loader=yaml.SafeLoader) | ||
del case_config['session_len_error'] | ||
return case_config | ||
|
||
|
||
@pytest.fixture(scope='session') | ||
def get_restful_case_List(request, case_config): | ||
case_path = os.path.join(request.config.rootdir, 'chat_prompt_case.yaml') | ||
print(case_path) | ||
with open(case_path) as f: | ||
case_config = yaml.load(f.read(), Loader=yaml.SafeLoader) | ||
return case_config |
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,8 @@ | ||
[pytest] | ||
; addopts = --html=../report/report.html # pytest-html报告插件配置 | ||
;addopts = -s --alluredir report # allure-pytest报告插件配置 | ||
; testpaths = ./scripts # 设置测试目录识别名称 | ||
python_files = test*_*.py # 设置测试文件识别名称 | ||
python_classes = Test* # 设置测试类识别名称 | ||
python_functions = test_* # 设置测试方法识别名称 | ||
filterwarnings = ignore::UserWarning |
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,59 @@ | ||
identity_case: | ||
- 你好,你叫什么名字#hi, what's your name: | ||
|
||
memory_test: | ||
- 介绍成都的景点#please introduce some attractions in Chengdu: | ||
- contain: | ||
- chengdu | ||
- 成都 | ||
- contain: | ||
- 熊猫 | ||
- panda | ||
- 介绍美食#please introduce some delicious foods: | ||
- contain: | ||
- 成都 | ||
- chengdu | ||
- contain: | ||
- 火锅 | ||
- hotpot | ||
- hot pot | ||
new_session_without_memory: | ||
- 介绍美食#please introduce some delicious foods: | ||
- not_contain: | ||
- 成都 | ||
- chengdu | ||
chinese_poem_case: | ||
- 给我一首中文打油诗,需要添加标点符号。和,Give me a Chinese poem in Chinese: | ||
- contain: | ||
- "," | ||
- "。" | ||
- 油 | ||
- len_g: | ||
10 | ||
english_poem_case: | ||
- write a romantic poem: | ||
- contain: | ||
- "," | ||
- contain: | ||
- "." | ||
- contain: | ||
- love | ||
- len_g: | ||
100 | ||
emoji_case: | ||
- 你能输出👍的emoji么#Can you output the emoji of 👍: | ||
- contain: | ||
- 👍 | ||
- 😊 | ||
traditional_chinese_case: | ||
- 請介紹香港維多利亞港,用繁體中文回答: | ||
- contain: | ||
- 維多利亞港 | ||
- 维多利亚港 | ||
- victoria | ||
session_len_error: | ||
- 这是很长的一段话这是很长的一段话这是很长的一段话这是很长的一段话这是很长的一段话: | ||
- contain: | ||
- exceed session max length. | ||
- contain: | ||
- Please end the session. |
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,125 @@ | ||
import os | ||
import subprocess | ||
from subprocess import PIPE | ||
|
||
import allure | ||
import pytest | ||
|
||
|
||
@pytest.mark.quantization | ||
@pytest.mark.CodeLlama_7b_Instruct_hf | ||
@allure.story('CodeLlama-7b-Instruct-hf') | ||
def future_test_quantization_CodeLlama_7b_Instruct_hf(config): | ||
result = quantization(config, 'CodeLlama-7b-Instruct-hf-inner-w4', | ||
'CodeLlama-7b-Instruct-hf') | ||
assert result.get('success'), result.get('msg') | ||
|
||
|
||
@pytest.mark.quantization | ||
@pytest.mark.llama_2_7b_chat | ||
@allure.story('llama-2-7b-chat') | ||
def test_quantization_llama_2_7b_chat(config): | ||
result = quantization(config, 'llama-2-7b-chat-inner-w4', | ||
'llama-2-7b-chat') | ||
assert result.get('success'), result.get('msg') | ||
|
||
|
||
@pytest.mark.quantization | ||
@pytest.mark.internlm_chat_20b | ||
@allure.story('internlm-chat-20b') | ||
def test_quantization_internlm_chat_20b(config): | ||
result = quantization(config, 'internlm-chat-20b-inner-w4', | ||
'internlm-chat-20b') | ||
assert result.get('success'), result.get('msg') | ||
|
||
|
||
@pytest.mark.quantization | ||
@pytest.mark.Qwen_14B_Chat | ||
@allure.story('Qwen-14B-Chat') | ||
def test_quantization_Qwen_14B_Chat(config): | ||
result = quantization(config, 'Qwen-14B-Chat-inner-w4', 'Qwen-14B-Chat') | ||
assert result.get('success'), result.get('msg') | ||
|
||
|
||
@pytest.mark.quantization | ||
@pytest.mark.Baichuan2_7B_Chat | ||
@allure.story('Baichuan2-7B-Chat') | ||
def test_quantization_Baichuan2_7B_Chat(config): | ||
result = quantization(config, 'Baichuan2-7B-Chat-inner-w4', | ||
'Baichuan2-7B-Chat') | ||
assert result.get('success'), result.get('msg') | ||
|
||
|
||
@pytest.mark.quantization | ||
@pytest.mark.Qwen_7B_Chat | ||
@allure.story('Qwen-7B-Chat') | ||
def test_quantization_Qwen_7B_Chat(config): | ||
result = quantization(config, 'Qwen-7B-Chat-inner-w4', 'Qwen-7B-Chat') | ||
assert result.get('success'), result.get('msg') | ||
|
||
|
||
def quantization(config, w4_model_name, origin_model_name): | ||
model_path = config.get('model_path') | ||
log_path = config.get('log_path') | ||
|
||
get_param_cmd = [ | ||
'lmdeploy lite calibrate --model ' + model_path + '/' + | ||
origin_model_name + ' --calib_dataset \'c4\' --calib_samples 128' + | ||
' --calib_seqlen 2048 --work_dir ' + model_path + '/' + w4_model_name | ||
] | ||
quantization_cmd = [ | ||
'lmdeploy lite auto_awq --model ' + model_path + '/' + | ||
origin_model_name + ' --w_bits 4 --w_group_size 128 ' + | ||
'--work_dir ' + model_path + '/' + w4_model_name | ||
] | ||
quantization_param_log = os.path.join( | ||
log_path, 'quantization_param_' + w4_model_name + '.log') | ||
quantization_log = os.path.join(log_path, | ||
'quantization_' + w4_model_name + '.log') | ||
|
||
with allure.step('step1 - get quantization params'): | ||
with open(quantization_param_log, 'w') as f: | ||
subprocess.run(['pwd'], | ||
stdout=f, | ||
stderr=f, | ||
shell=True, | ||
text=True, | ||
encoding='utf-8') | ||
f.writelines('commondLine get_param_cmd: ' + | ||
' '.join(get_param_cmd) + '\n') | ||
# get params | ||
getParamsRes = subprocess.run(get_param_cmd, | ||
stdout=f, | ||
stderr=PIPE, | ||
shell=True, | ||
text=True, | ||
encoding='utf-8') | ||
f.writelines(getParamsRes.stderr) | ||
result = getParamsRes.returncode == 0 | ||
|
||
allure.attach.file(quantization_param_log, | ||
attachment_type=allure.attachment_type.TEXT) | ||
if result is False: | ||
return { | ||
'success': result, | ||
'quantization_param_log': quantization_param_log, | ||
'msg': getParamsRes.stderr | ||
} | ||
|
||
with allure.step('step2 - quantization'): | ||
with open(quantization_log, 'w') as f: | ||
f.writelines('commondLine quantization_cmd: ' + | ||
' '.join(quantization_cmd) + '\n') | ||
# convert | ||
quantizationRes = subprocess.run(quantization_cmd, | ||
stdout=f, | ||
stderr=PIPE, | ||
shell=True, | ||
text=True, | ||
encoding='utf-8') | ||
f.writelines(quantizationRes.stderr) | ||
result = quantizationRes.returncode == 0 | ||
|
||
allure.attach.file(quantization_log, | ||
attachment_type=allure.attachment_type.TEXT) | ||
return {'success': result, 'msg': getParamsRes.stderr} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
啊这,打油诗要有油 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AllentDan wrong branch, pls. check pr #823