Skip to content
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

remove first empty token check and add input validation testcase #1549

Merged
merged 9 commits into from
May 8, 2024

Conversation

zhulinJulia24
Copy link
Collaborator

@zhulinJulia24 zhulinJulia24 commented May 6, 2024

  1. add input validate testcases for Add input validation #1525
  2. remove first empty token check in streaming during the change of Remove first empty chunck for api_server #1527
  3. add logprobs assert utils for future use

@@ -842,3 +958,124 @@ def test_longtext_input_streaming(self):
assert outputList[0].get('finish_reason') == 'length', outputList
assert outputList[0].get('text') == ''
assert len(outputList) == 1

def test_input_validation(self):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

怎么有两个 test_input_validation

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test_input_validation

外层有个class,分别覆盖interactive接口和chat-complation接口

@zhulinJulia24
Copy link
Collaborator Author

assert_chat_completions_stream_return(outputList[index],
MODEL_NAME)
assert outputList[-1].get('choices')[0].get(
'finish_reason') == 'length'
assert len(outputList) == 102
assert len(outputList) == 101
Copy link
Collaborator

@AllentDan AllentDan May 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we use such strict rules? we can just encode the output and check if the token number is equal to max_tokens

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It make sense. I can chage according this.

Copy link
Collaborator

@AllentDan AllentDan May 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is an endpoint named encode in api_server. You may try it directly.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is an endpoint named encode in api_server. You may try it directly.

used encode to get token numbers?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think @AllentDan means assert max_tokens==api_client.encode(response, add_bos=False)[1]

Copy link
Collaborator

@RunningLeon RunningLeon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lvhan028 lvhan028 merged commit 9ab55f0 into InternLM:main May 8, 2024
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants