Higher priority for user input of max_prefill_tokens & format (#540)
This commit is contained in:
@@ -356,16 +356,25 @@ def test_completion_speculative():
|
||||
s += "Construct a character within the following format:\n"
|
||||
s += "Name: Steve Jobs.\nBirthday: February 24, 1955.\nJob: Apple CEO.\n"
|
||||
s += "\nPlease generate new Name, Birthday and Job.\n"
|
||||
s += "Name:" + sgl.gen("name", stop="\n") + "\nBirthday:" + sgl.gen("birthday", stop="\n")
|
||||
s += (
|
||||
"Name:"
|
||||
+ sgl.gen("name", stop="\n")
|
||||
+ "\nBirthday:"
|
||||
+ sgl.gen("birthday", stop="\n")
|
||||
)
|
||||
s += "\nJob:" + sgl.gen("job", stop="\n") + "\n"
|
||||
|
||||
|
||||
@sgl.function
|
||||
def gen_character_no_spec(s):
|
||||
s += "Construct a character within the following format:\n"
|
||||
s += "Name: Steve Jobs.\nBirthday: February 24, 1955.\nJob: Apple CEO.\n"
|
||||
s += "\nPlease generate new Name, Birthday and Job.\n"
|
||||
s += "Name:" + sgl.gen("name", stop="\n") + "\nBirthday:" + sgl.gen("birthday", stop="\n")
|
||||
s += (
|
||||
"Name:"
|
||||
+ sgl.gen("name", stop="\n")
|
||||
+ "\nBirthday:"
|
||||
+ sgl.gen("birthday", stop="\n")
|
||||
)
|
||||
s += "\nJob:" + sgl.gen("job", stop="\n") + "\n"
|
||||
|
||||
token_usage = sgl.global_config.default_backend.token_usage
|
||||
@@ -378,7 +387,9 @@ def test_completion_speculative():
|
||||
gen_character_no_spec().sync()
|
||||
usage_with_no_spec = token_usage.prompt_tokens
|
||||
|
||||
assert usage_with_spec < usage_with_no_spec, f"{usage_with_spec} vs {usage_with_no_spec}"
|
||||
assert (
|
||||
usage_with_spec < usage_with_no_spec
|
||||
), f"{usage_with_spec} vs {usage_with_no_spec}"
|
||||
|
||||
|
||||
def test_chat_completion_speculative():
|
||||
@@ -386,8 +397,17 @@ def test_chat_completion_speculative():
|
||||
def gen_character_spec(s):
|
||||
s += sgl.system("You are a helpful assistant.")
|
||||
s += sgl.user("Construct a character within the following format:")
|
||||
s += sgl.assistant("Name: Steve Jobs.\nBirthday: February 24, 1955.\nJob: Apple CEO.\n")
|
||||
s += sgl.assistant(
|
||||
"Name: Steve Jobs.\nBirthday: February 24, 1955.\nJob: Apple CEO.\n"
|
||||
)
|
||||
s += sgl.user("Please generate new Name, Birthday and Job.\n")
|
||||
s += sgl.assistant("Name:" + sgl.gen("name", stop="\n") + "\nBirthday:" + sgl.gen("birthday", stop="\n") + "\nJob:" + sgl.gen("job", stop="\n"))
|
||||
s += sgl.assistant(
|
||||
"Name:"
|
||||
+ sgl.gen("name", stop="\n")
|
||||
+ "\nBirthday:"
|
||||
+ sgl.gen("birthday", stop="\n")
|
||||
+ "\nJob:"
|
||||
+ sgl.gen("job", stop="\n")
|
||||
)
|
||||
|
||||
gen_character_spec().sync()
|
||||
gen_character_spec().sync()
|
||||
|
||||
Reference in New Issue
Block a user