import pytest | |
import requests | |
from environs import Env | |
env = Env() | |
env.read_env(override=True) | |
def test_incompatible_model(): | |
with pytest.raises(requests.exceptions.HTTPError): | |
response = requests.post( | |
f"{env.str('ENDPOINT')}/convert_awq", | |
json={ | |
"hf_model_name": "gpt2", | |
"hf_tokenizer_name": "gpt2", | |
"hf_push_repo": None, | |
} | |
) | |
response.raise_for_status() | |
assert response.status_code == 400 | |
def test_convert_download(): | |
response = requests.post( | |
f"{env.str('ENDPOINT')}/convert_awq", | |
json={ | |
"hf_model_name": "Qwen/Qwen2.5-7B-Instruct", | |
} | |
) | |
response.raise_for_status() | |
assert response.content_type == 'application/zip' | |
def test_convert_push(): | |
model_name = "Qwen/Qwen2.5-7B-Instruct" | |
response = requests.post( | |
f"{env.str('ENDPOINT')}/convert_awq", | |
json={ | |
"hf_model_name": "Qwen/Qwen2.5-14B-Instruct", | |
"hf_push_repo": env.str("HF_PUSH_REPO") or f"{env.str('HF_ORGANIZATION')}/{model_name.split('/')[-1]}-AWQ", | |
} | |
) | |
response.raise_for_status() |