-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinference_types.py
More file actions
46 lines (36 loc) · 1.04 KB
/
inference_types.py
File metadata and controls
46 lines (36 loc) · 1.04 KB
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
from dataclasses import dataclass
from typing import List, Optional
@dataclass
class Message:
role: str
content: str
@dataclass
class GenerateRequest:
messages: List[Message]
max_output_length: Optional[int] = 2048
temperature: Optional[float] = 0.1
top_p: Optional[float] = 1
top_k: Optional[int] = 16
repetition_penalty: Optional[float] = 1.1
streaming: Optional[bool] = False
@dataclass
class GenerateResponse:
response: Message
generation_tokens: int
generation_time: float
tokens_per_second: float
@dataclass
class BatchGenerateRequest:
batch_messages: List[List[Message]]
max_output_length: Optional[int] = 2048
temperature: Optional[float] = 0.1
top_p: Optional[float] = 1
top_k: Optional[int] = 16
repetition_penalty: Optional[float] = 1.1
streaming: Optional[bool] = False
@dataclass
class BatchGenerateResponse:
batch_responses: List[List[Message]]
batch_generation_tokens: List[int]
generation_time: float
max_throughput_tokens_per_second: float