locustfile.py 1 KB
Newer Older
Fazzie-Maqianli's avatar
Fazzie-Maqianli committed
1
2
from locust import HttpUser, task

3
4
5
6
7
8
9
10
11
12
13
14
samples = [
    [
        dict(
            instruction="Who is the best player in the history of NBA?",
            response="The best player in the history of the NBA is widely considered to be Michael Jordan. He is one of the most successful players in the league, having won 6 NBA championships with the Chicago Bulls and 5 more with the Washington Wizards. He is a 5-time MVP, 1",
        ),
        dict(instruction="continue this talk", response=""),
    ],
    [
        dict(instruction="Who is the best player in the history of NBA?", response=""),
    ],
]
Fazzie-Maqianli's avatar
Fazzie-Maqianli committed
15
16
17
18
19
20


class GenerationUser(HttpUser):
    @task
    def generate(self):
        for sample in samples:
21
22
            data = {"max_new_tokens": 64, "history": sample}
            with self.client.post("/generate", json=data, catch_response=True) as response:
Fazzie-Maqianli's avatar
Fazzie-Maqianli committed
23
24
25
                if response.status_code in (200, 406):
                    response.success()
                else:
26
                    response.failure("Response wrong")