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

Verification check for model - VLLM #10

Merged
merged 2 commits into from
Jul 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions language/llama2-70b/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,27 @@
import os
import logging
import sys
import requests
import json

sys.path.insert(0, os.getcwd())

logging.basicConfig(level=logging.INFO)
log = logging.getLogger("Llama-70B-MAIN")

# function to check the model name in server matches the user specified one
def verify_model_name(user_specified_name, url):
response = requests.get(url)
if response.status_code == 200:
response_dict = response.json()
server_model_name = response_dict["data"][0]["id"]
if user_specified_name == server_model_name:
return {"matched":True, "error":False}
else:
return {"matched":False, "error":f"User specified {user_specified_name} and server model name {server_model_name} mismatch!"}
else:
return {"matched":False, "error":f"Failed to get a valid response. Status code: {response.status_code}"}

def get_args():
parser = argparse.ArgumentParser()
parser.add_argument("--scenario", type=str, choices=["Offline", "Server"], default="Offline", help="Scenario")
Expand Down Expand Up @@ -41,6 +56,13 @@ def get_args():

def main():
args = get_args()

if args.vllm:
resp = verify_model_name(args.api_model_name, args.api_server+"/v1/models")
if resp["error"]:
print(f"\n\n\033[91mError:\033[0m", end=" ")
print(resp["error"])
sys.exit(1)

settings = lg.TestSettings()
settings.scenario = scenario_map[args.scenario.lower()]
Expand Down
Loading