-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlatency_test.py
More file actions
124 lines (118 loc) · 4.89 KB
/
latency_test.py
File metadata and controls
124 lines (118 loc) · 4.89 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
from src.pipeline.predict_pipeline import PredictPipeline
import time
test_sentences = sentences = [
"I love this movie so much!",
"This is the worst experience I've ever had.",
"I feel so excited about the upcoming trip.",
"I'm really angry about how things turned out.",
"This is the best day of my life!",
"I can't believe how amazing this is.",
"I'm so frustrated with this process.",
"What a joyful moment!",
"I hate this with all my heart.",
"This fills me with so much happiness.",
"I feel sad and defeated today.",
"I'm incredibly grateful for this opportunity.",
"Why does this always happen to me?",
"This makes me feel so loved.",
"I don't know how to handle this situation.",
"What a wonderful surprise!",
"I'm scared about what might happen next.",
"This is absolutely incredible!",
"I'm deeply disappointed in the outcome.",
"I can't stop smiling!",
"This makes me feel so proud.",
"Why is this happening to us?",
"I feel a sense of peace and contentment.",
"This is so confusing and frustrating.",
"I'm overjoyed to see you again!",
"This fills me with dread and anxiety.",
"I'm absolutely thrilled!",
"This makes me feel completely helpless.",
"What a beautiful way to start the day!",
"I'm shocked and horrified by this news.",
"This fills me with hope and optimism.",
"I feel like everything is falling apart.",
"What a hilarious joke!",
"This breaks my heart into pieces.",
"I'm so proud of what we've accomplished.",
"This leaves me feeling hollow and empty.",
"I'm in awe of your talent and skill.",
"This makes me question everything I thought I knew.",
"What an incredible achievement!",
"This feels like a never-ending nightmare.",
"I'm filled with gratitude for your kindness.",
"This is so overwhelming and difficult to process.",
"What a delightful surprise!",
"This makes me feel unworthy and inadequate.",
"I'm so impressed by your dedication.",
"This situation is driving me insane.",
"What a heartwarming moment!",
"This makes me feel like giving up.",
"I'm inspired by your courage and strength.",
"This fills me with doubt and uncertainty.",
"What a breathtaking view!",
"This makes me feel insignificant and small.",
"I'm so relieved to hear that everything is okay.",
"This news is devastating and hard to accept.",
"What a thoughtful and generous gift!",
"This makes me feel completely lost.",
"I'm amazed by your creativity and imagination.",
"This feels like a heavy burden to carry.",
"What a memorable day!",
"This makes me feel like I'm not good enough.",
"I'm so excited for what lies ahead.",
"This situation is incredibly frustrating.",
"What a touching and heartfelt message!",
"This makes me feel utterly hopeless.",
"I'm so glad we could share this moment together.",
"This leaves me feeling betrayed and hurt.",
"What a funny and clever idea!",
"This makes me feel like I'm not in control.",
"I'm so grateful to have you in my life.",
"This feels like a difficult choice to make.",
"What an inspiring story!",
"This fills me with regret and remorse.",
"I'm over the moon with excitement!",
"This makes me feel like I'm not enough.",
"I'm so happy for your success!",
"This situation is testing my patience.",
"What a magical and enchanting evening!",
"This makes me feel like I'm failing.",
"I'm so thankful for your support.",
"This fills me with anger and resentment.",
"What a beautiful and serene place!",
"This makes me feel like giving up hope.",
"I'm so proud of how far we've come.",
"This situation is tearing me apart.",
"What a surprising and unexpected turn of events!",
"This makes me feel like I've let everyone down.",
"I'm so relieved that everything worked out.",
"This fills me with sorrow and grief.",
"What an uplifting and positive message!",
"This makes me feel like I'm not valued.",
"I'm so excited to start this new chapter.",
"This feels like a never-ending struggle.",
"What an extraordinary accomplishment!",
"This makes me feel like I'm trapped.",
"I'm so honored to be a part of this journey.",
"This fills me with anxiety and fear.",
"What a joyous and happy occasion!",
"This makes me feel like I'm losing everything.",
]
class_labels = {
0: "Sadness",
1: "Joy",
2: "Love",
3: "Anger",
4: "Fear",
5: "Surprise"
}
Predictor = PredictPipeline(class_labels=class_labels)
start_time = time.time()
pred = Predictor.predict(test_sentences)
end_time = time.time()
latency_ms = (end_time - start_time) * 1000
print(f"Batch Size: {len(test_sentences)}")
print(f"Predictions: {pred}")
print(f"Batch Latency: {latency_ms:.2f} ms")