-
Notifications
You must be signed in to change notification settings - Fork 430
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
fix multinomial sampling #1228
Merged
Merged
fix multinomial sampling #1228
Conversation
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
pipeline test result:
Share pipeline test script: from lmdeploy import pipeline, GenerationConfig, PytorchEngineConfig
import multiprocessing
models = [
('llama2', '/workspace/models-140/llama2/huggingface/llama-2-7b-chat/'),
('llama2', '/workspace/models-140/llama2/huggingface/llama-2-13b-chat/'),
('internlm2-chat-7b', '/workspace/models-140/InternLM/internlm2-chat-7b'),
('internlm2-chat-20b', '/workspace/models-140/InternLM/internlm2-chat-20b'),
('internlm-chat-7b', '/workspace/models-140/InternLM/internlm-chat-7b'),
('internlm-chat-20b', '/workspace/models-140/InternLM/internlm-chat-20b'),
# ('qwen-7b', '/workspace/models-140/Qwen/Qwen-7B-Chat/'), # not supported yet
# ('qwen-14b', '/workspace/models-140/Qwen/Qwen-14B-Chat/'), # not supported yet
('qwen1.5', '/workspace/models-140/Qwen/Qwen1.5-7B-Chat/'),
# ('baichuan', '/workspace/models-140/baichuan/Baichuan-13B-Chat/'), # transformers 版本太高
('baichuan2', '/workspace/models-140/baichuan2/Baichuan2-7B-Chat/'),
('baichuan2', '/workspace/models-140/baichuan2/Baichuan2-13B-Chat/'),
('codellama', '/workspace/models-140/codellama/CodeLlama-7b-Instruct-hf/'),
('chatglm2', '/workspace/models-140/chatglm2-6b/'),
('chatglm3', '/workspace/models-140/chatglm3-6b/'),
('falcon', '/workspace/models-142/models/falcon-7b-instruct/'),
('yi', '/workspace/models-140/Yi/Yi-34B-Chat/'),
('mistral', '/workspace/models-140/mistralai/models--mistralai--Mistral-7B-Instruct-v0.1/snapshots/9ab9e76e2b09f9f29ea2d56aa5bd139e4445c59e'),
('deepseek', '/workspace/models-140/deepseek/deepseek-coder-1.3b-instruct'),
('mixtral', '/workspace/models-140/mistralai/Mixtral-8x7B-Instruct-v0.1/'),
('gemma', '/workspace/models-140/Gemma/gemma-7b-it')
]
def test_pipeline(model_path, prompts, **kwargs):
print(f'-- start to test model: {model_path}')
try:
if kwargs:
print(f'kwargs: {kwargs}')
backend_config=PytorchEngineConfig()
gen_config=GenerationConfig()
for k, v in kwargs.items():
if hasattr(backend_config, k):
setattr(backend_config, k, v)
if hasattr(gen_config, k):
setattr(gen_config, k, v)
print(backend_config)
else:
print(f'empty kwargs')
backend_config=PytorchEngineConfig()
gen_config = None
pipe = pipeline(model_path, backend_config=backend_config, log_level='INFO')
response = pipe(prompts, gen_config=gen_config)
print(response)
print(f'-- test successfully')
except Exception as e:
print(f'-- test model failed with {e}')
raise(RuntimeError, 'build pipe failed')
if __name__ == '__main__':
# pytorch engine default parameters
for model_name, model_path in models:
args = (model_path, ["Hi, pls intro yourself", "Shanghai is"], )
if model_name == 'mixtral':
# at least 2 GPUs are required
continue
proc = multiprocessing.Process(target=test_pipeline, args=args)
proc.start()
proc.join()
# pytorch engine tp
for _, model_path in models:
args = (model_path, ["Hi, pls intro yourself", "Shanghai is"], )
proc = multiprocessing.Process(target=test_pipeline, args=args, kwargs=dict(tp=2))
proc.start()
proc.join()
# generate config
for _, model_path in models:
args = (model_path, ["Hi, pls intro yourself", "Shanghai is"], )
proc = multiprocessing.Process(
target=test_pipeline,
args=args,
kwargs=dict(tp=2,
top_k=40,
top_p=0.8,
temperature=0.6,
repetition_penalty=1.002)
)
proc.start()
proc.join() |
lvhan028
approved these changes
Mar 2, 2024
falcon tp error would be fixed in other pr |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.