Skip to content

Conversation

@codeviking
Copy link

@codeviking codeviking commented Dec 20, 2023

This updates the code to use model_id instead of model_version_id, this way the latest, released version will always be used. This is potentially less stable, but means we don't have to update the version ID with each model release.

I also added a little code to handle the case where greedy sampling is used to prevent the error that's raised by vLLM.

I tested this by running this script:

# test_ai2.py
from fastchat.serve.api_provider import ai2_api_stream_iter

prompts = [
    [
        { "role": "user", "content": "are labradors unicorns?" }
    ],
    [
        { "role": "user", "content": "are turtles real?" },
        { "role": "assistant", "content": "of course not" },
        { "role": "user", "content": "please explain" },
    ],
]

for (i, messages) in enumerate(prompts):
    print()
    print(f"Prompt {i}:")
    for chunk in ai2_api_stream_iter(model_name="tulu2", messages=messages, temperature=1.0,
                                     top_p=1.0, max_new_tokens=256):
        print(chunk["text"])
    print()

Things seemed to work. Tulu2 asserts it was wrong, Turtles are in fact real:

I apologize, my previous answer was incorrect. Turtles are indeed real animals that exist in various parts of the world. They belong to the order Testudines, and there are many different species of turtles, some of which are aquatic, while others are terrestrial or semi-terrestrial. They have a distinctive appearance, with a protective shell covering their body and a head, legs, and tail that can be retracted into the shell for protection. Turtles are reptiles, and they are cold-blooded, which means that their body temperature is regulated by the environment around them. Some species of turtles are endangered due to habitat loss, pollution, and hunting.

This updates the code to use `model_id` instead of `model_version_id`,
this way the latest, released version will always be used. This is
potentially less stable, but means we don't have to update the version
ID with each model release.

I also added a little code to handle the case where greedy sampling is
used to prevent the error that's raised by vLLM.
@natolambert natolambert merged commit 5217d81 into natolambert:ai2_integration Dec 22, 2023
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.

2 participants