File size: 1,203 Bytes
edebf90
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3081464
 
 
edebf90
 
 
 
 
 
 
3081464
edebf90
 
 
 
 
 
 
 
 
3081464
edebf90
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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()