jadehardouin commited on
Commit
db28a13
1 Parent(s): 373e8e8

Update models.py

Browse files
Files changed (1) hide show
  1. models.py +25 -25
models.py CHANGED
@@ -49,7 +49,7 @@ class OpenAIModelGPT4(BaseTCOModel):
49
 
50
  def __init__(self):
51
  self.set_name("(SaaS) OpenAI GPT4")
52
- self.latency = "15s" #Default value for GPT4
53
  super().__init__()
54
 
55
  def render(self):
@@ -65,16 +65,16 @@ class OpenAIModelGPT4(BaseTCOModel):
65
  self.context_length = gr.Dropdown(["8K", "32K"], value="8K", interactive=True,
66
  label="Context size",
67
  visible=False, info="Number of tokens the model considers when processing text")
68
- self.input_tokens_cost_per_second = gr.Number(0.03, visible=False,
69
  label="($) Price/1K input prompt tokens",
70
  interactive=False
71
  )
72
- self.output_tokens_cost_per_second = gr.Number(0.06, visible=False,
73
  label="($) Price/1K output prompt tokens",
74
  interactive=False
75
  )
76
  self.info = gr.Markdown("The cost per input and output tokens values are from OpenAI's [pricing web page](https://openai.com/pricing)", interactive=False, visible=False)
77
- self.context_length.change(define_cost_per_token, inputs=self.context_length, outputs=[self.input_tokens_cost_per_second, self.output_tokens_cost_per_second])
78
 
79
  self.labor = gr.Number(0, visible=False,
80
  label="($) Labor cost per month",
@@ -82,9 +82,9 @@ class OpenAIModelGPT4(BaseTCOModel):
82
  interactive=True
83
  )
84
 
85
- def compute_cost_per_token(self, input_tokens_cost_per_second, output_tokens_cost_per_second, labor):
86
- cost_per_input_token = (input_tokens_cost_per_second / 1000)
87
- cost_per_output_token = (output_tokens_cost_per_second / 1000)
88
 
89
  return cost_per_input_token, cost_per_output_token, labor
90
 
@@ -92,7 +92,7 @@ class OpenAIModelGPT3_5(BaseTCOModel):
92
 
93
  def __init__(self):
94
  self.set_name("(SaaS) OpenAI GPT3.5 Turbo")
95
- self.latency = "5s" #Default value for GPT3.5 Turbo
96
  super().__init__()
97
 
98
  def render(self):
@@ -108,16 +108,16 @@ class OpenAIModelGPT3_5(BaseTCOModel):
108
  self.context_length = gr.Dropdown(choices=["4K", "16K"], value="4K", interactive=True,
109
  label="Context size",
110
  visible=False, info="Number of tokens the model considers when processing text")
111
- self.input_tokens_cost_per_second = gr.Number(0.0015, visible=False,
112
  label="($) Price/1K input prompt tokens",
113
  interactive=False
114
  )
115
- self.output_tokens_cost_per_second = gr.Number(0.002, visible=False,
116
  label="($) Price/1K output prompt tokens",
117
  interactive=False
118
  )
119
  self.info = gr.Markdown("The cost per input and output tokens values are from OpenAI's [pricing web page](https://openai.com/pricing)", interactive=False, visible=False)
120
- self.context_length.change(define_cost_per_token, inputs=self.context_length, outputs=[self.input_tokens_cost_per_second, self.output_tokens_cost_per_second])
121
 
122
  self.labor = gr.Number(0, visible=False,
123
  label="($) Labor cost per month",
@@ -125,9 +125,9 @@ class OpenAIModelGPT3_5(BaseTCOModel):
125
  interactive=True
126
  )
127
 
128
- def compute_cost_per_token(self, input_tokens_cost_per_second, output_tokens_cost_per_second, labor):
129
- cost_per_input_token = (input_tokens_cost_per_second / 1000)
130
- cost_per_output_token = (output_tokens_cost_per_second / 1000)
131
 
132
  return cost_per_input_token, cost_per_output_token, labor
133
 
@@ -147,11 +147,11 @@ class OpenSourceLlama2Model(BaseTCOModel):
147
  self.vm_cost_per_hour = gr.Number(4.42, label="Instance cost ($) per hour",
148
  interactive=False, visible=False)
149
  self.info_vm = gr.Markdown("This price above is from [CoreWeave's pricing web page](https://www.coreweave.com/gpu-cloud-pricing)", interactive=False, visible=False)
150
- self.input_tokens_cost_per_second = gr.Number(0.00052, visible=False,
151
  label="($) Price/1K input prompt tokens",
152
  interactive=False
153
  )
154
- self.output_tokens_cost_per_second = gr.Number(0.06656, visible=False,
155
  label="($) Price/1K output prompt tokens",
156
  interactive=False
157
  )
@@ -167,9 +167,9 @@ class OpenSourceLlama2Model(BaseTCOModel):
167
  interactive=True
168
  )
169
 
170
- def compute_cost_per_token(self, input_tokens_cost_per_second, output_tokens_cost_per_second, labor):
171
- cost_per_input_token = (input_tokens_cost_per_second / 1000)
172
- cost_per_output_token = (output_tokens_cost_per_second / 1000)
173
  return cost_per_input_token, cost_per_output_token, labor
174
 
175
  class CohereModel(BaseTCOModel):
@@ -190,26 +190,26 @@ class CohereModel(BaseTCOModel):
190
  self.model = gr.Dropdown(["Default", "Custom"], value="Default",
191
  label="Model",
192
  interactive=True, visible=False)
193
- self.input_tokens_cost_per_second = gr.Number(0.015, visible=False,
194
  label="($) Price/1K input prompt tokens",
195
  interactive=False
196
  )
197
- self.output_tokens_cost_per_second = gr.Number(0.015, visible=False,
198
  label="($) Price/1K output prompt tokens",
199
  interactive=False
200
  )
201
  self.info = gr.Markdown("The cost per input and output tokens value is from Cohere's [pricing web page](https://cohere.com/pricing?utm_term=&utm_campaign=Cohere+Brand+%26+Industry+Terms&utm_source=adwords&utm_medium=ppc&hsa_acc=4946693046&hsa_cam=20368816223&hsa_grp=154209120409&hsa_ad=666081801359&hsa_src=g&hsa_tgt=dsa-19959388920&hsa_kw=&hsa_mt=&hsa_net=adwords&hsa_ver=3&gad=1&gclid=CjwKCAjww7KmBhAyEiwA5-PUSlyO7pq0zxeVrhViXMd8WuILW6uY-cfP1-SVuUfs-leUAz14xHlOHxoCmfkQAvD_BwE)", interactive=False, visible=False)
202
- self.model.change(on_model_change, inputs=self.model, outputs=[self.input_tokens_cost_per_second, self.output_tokens_cost_per_second])
203
  self.labor = gr.Number(0, visible=False,
204
  label="($) Labor cost per month",
205
  info="This is an estimate of the labor cost of the AI engineer in charge of deploying the model",
206
  interactive=True
207
  )
208
 
209
- def compute_cost_per_token(self, input_tokens_cost_per_second, output_tokens_cost_per_second, labor):
210
 
211
- cost_per_input_token = input_tokens_cost_per_second / 1000
212
- cost_per_output_token = output_tokens_cost_per_second / 1000
213
 
214
  return cost_per_input_token, cost_per_output_token, labor
215
 
 
49
 
50
  def __init__(self):
51
  self.set_name("(SaaS) OpenAI GPT4")
52
+ self.set_latency("15s") #Default value for GPT4
53
  super().__init__()
54
 
55
  def render(self):
 
65
  self.context_length = gr.Dropdown(["8K", "32K"], value="8K", interactive=True,
66
  label="Context size",
67
  visible=False, info="Number of tokens the model considers when processing text")
68
+ self.input_tokens_cost_per_token = gr.Number(0.03, visible=False,
69
  label="($) Price/1K input prompt tokens",
70
  interactive=False
71
  )
72
+ self.output_tokens_cost_per_token = gr.Number(0.06, visible=False,
73
  label="($) Price/1K output prompt tokens",
74
  interactive=False
75
  )
76
  self.info = gr.Markdown("The cost per input and output tokens values are from OpenAI's [pricing web page](https://openai.com/pricing)", interactive=False, visible=False)
77
+ self.context_length.change(define_cost_per_token, inputs=self.context_length, outputs=[self.input_tokens_cost_per_token, self.output_tokens_cost_per_token])
78
 
79
  self.labor = gr.Number(0, visible=False,
80
  label="($) Labor cost per month",
 
82
  interactive=True
83
  )
84
 
85
+ def compute_cost_per_token(self, input_tokens_cost_per_token, output_tokens_cost_per_token, labor):
86
+ cost_per_input_token = (input_tokens_cost_per_token / 1000)
87
+ cost_per_output_token = (output_tokens_cost_per_token / 1000)
88
 
89
  return cost_per_input_token, cost_per_output_token, labor
90
 
 
92
 
93
  def __init__(self):
94
  self.set_name("(SaaS) OpenAI GPT3.5 Turbo")
95
+ self.set_latency("5s") #Default value for GPT3.5 Turbo
96
  super().__init__()
97
 
98
  def render(self):
 
108
  self.context_length = gr.Dropdown(choices=["4K", "16K"], value="4K", interactive=True,
109
  label="Context size",
110
  visible=False, info="Number of tokens the model considers when processing text")
111
+ self.input_tokens_cost_per_token = gr.Number(0.0015, visible=False,
112
  label="($) Price/1K input prompt tokens",
113
  interactive=False
114
  )
115
+ self.output_tokens_cost_per_token = gr.Number(0.002, visible=False,
116
  label="($) Price/1K output prompt tokens",
117
  interactive=False
118
  )
119
  self.info = gr.Markdown("The cost per input and output tokens values are from OpenAI's [pricing web page](https://openai.com/pricing)", interactive=False, visible=False)
120
+ self.context_length.change(define_cost_per_token, inputs=self.context_length, outputs=[self.input_tokens_cost_per_token, self.output_tokens_cost_per_token])
121
 
122
  self.labor = gr.Number(0, visible=False,
123
  label="($) Labor cost per month",
 
125
  interactive=True
126
  )
127
 
128
+ def compute_cost_per_token(self, input_tokens_cost_per_token, output_tokens_cost_per_token, labor):
129
+ cost_per_input_token = (input_tokens_cost_per_token / 1000)
130
+ cost_per_output_token = (output_tokens_cost_per_token / 1000)
131
 
132
  return cost_per_input_token, cost_per_output_token, labor
133
 
 
147
  self.vm_cost_per_hour = gr.Number(4.42, label="Instance cost ($) per hour",
148
  interactive=False, visible=False)
149
  self.info_vm = gr.Markdown("This price above is from [CoreWeave's pricing web page](https://www.coreweave.com/gpu-cloud-pricing)", interactive=False, visible=False)
150
+ self.input_tokens_cost_per_token = gr.Number(0.00052, visible=False,
151
  label="($) Price/1K input prompt tokens",
152
  interactive=False
153
  )
154
+ self.output_tokens_cost_per_token = gr.Number(0.06656, visible=False,
155
  label="($) Price/1K output prompt tokens",
156
  interactive=False
157
  )
 
167
  interactive=True
168
  )
169
 
170
+ def compute_cost_per_token(self, input_tokens_cost_per_token, output_tokens_cost_per_token, labor):
171
+ cost_per_input_token = (input_tokens_cost_per_token / 1000)
172
+ cost_per_output_token = (output_tokens_cost_per_token / 1000)
173
  return cost_per_input_token, cost_per_output_token, labor
174
 
175
  class CohereModel(BaseTCOModel):
 
190
  self.model = gr.Dropdown(["Default", "Custom"], value="Default",
191
  label="Model",
192
  interactive=True, visible=False)
193
+ self.input_tokens_cost_per_token = gr.Number(0.015, visible=False,
194
  label="($) Price/1K input prompt tokens",
195
  interactive=False
196
  )
197
+ self.output_tokens_cost_per_token = gr.Number(0.015, visible=False,
198
  label="($) Price/1K output prompt tokens",
199
  interactive=False
200
  )
201
  self.info = gr.Markdown("The cost per input and output tokens value is from Cohere's [pricing web page](https://cohere.com/pricing?utm_term=&utm_campaign=Cohere+Brand+%26+Industry+Terms&utm_source=adwords&utm_medium=ppc&hsa_acc=4946693046&hsa_cam=20368816223&hsa_grp=154209120409&hsa_ad=666081801359&hsa_src=g&hsa_tgt=dsa-19959388920&hsa_kw=&hsa_mt=&hsa_net=adwords&hsa_ver=3&gad=1&gclid=CjwKCAjww7KmBhAyEiwA5-PUSlyO7pq0zxeVrhViXMd8WuILW6uY-cfP1-SVuUfs-leUAz14xHlOHxoCmfkQAvD_BwE)", interactive=False, visible=False)
202
+ self.model.change(on_model_change, inputs=self.model, outputs=[self.input_tokens_cost_per_token, self.output_tokens_cost_per_token])
203
  self.labor = gr.Number(0, visible=False,
204
  label="($) Labor cost per month",
205
  info="This is an estimate of the labor cost of the AI engineer in charge of deploying the model",
206
  interactive=True
207
  )
208
 
209
+ def compute_cost_per_token(self, input_tokens_cost_per_token, output_tokens_cost_per_token, labor):
210
 
211
+ cost_per_input_token = input_tokens_cost_per_token / 1000
212
+ cost_per_output_token = output_tokens_cost_per_token / 1000
213
 
214
  return cost_per_input_token, cost_per_output_token, labor
215