Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Commit
·
47fac84
1
Parent(s):
891402c
real
Browse files- .env +1 -124
- src/lib/server/textGeneration/generate.ts +5 -5
.env
CHANGED
@@ -138,130 +138,7 @@ ALLOW_IFRAME=true # Allow the app to be embedded in an iframe
|
|
138 |
|
139 |
### Tools ###
|
140 |
# Check out public config in `chart/env/prod.yaml` for more details
|
141 |
-
TOOLS=`[
|
142 |
-
{
|
143 |
-
"_id": "000000000000000000000001",
|
144 |
-
"displayName": "Image Generation",
|
145 |
-
"description": "Use this tool to generate images based on a prompt.",
|
146 |
-
"color": "yellow",
|
147 |
-
"icon": "camera",
|
148 |
-
"baseUrl": "black-forest-labs/FLUX.1-schnell",
|
149 |
-
"name": "image_generation",
|
150 |
-
"endpoint": "/infer",
|
151 |
-
"inputs": [
|
152 |
-
{
|
153 |
-
"name": "prompt",
|
154 |
-
"description": "A prompt to generate an image from",
|
155 |
-
"paramType": "required",
|
156 |
-
"type": "str"
|
157 |
-
},
|
158 |
-
{ "name": "seed", "paramType": "fixed", "value": "0", "type": "float" },
|
159 |
-
{
|
160 |
-
"name": "randomize_seed",
|
161 |
-
"paramType": "fixed",
|
162 |
-
"value": "true",
|
163 |
-
"type": "bool"
|
164 |
-
},
|
165 |
-
{
|
166 |
-
"name": "width",
|
167 |
-
"description": "numeric value between 256 and 2048",
|
168 |
-
"paramType": "optional",
|
169 |
-
"default": 1024,
|
170 |
-
"type": "float"
|
171 |
-
},
|
172 |
-
{
|
173 |
-
"name": "height",
|
174 |
-
"description": "numeric value between 256 and 2048",
|
175 |
-
"paramType": "optional",
|
176 |
-
"default": 1024,
|
177 |
-
"type": "float"
|
178 |
-
},
|
179 |
-
{
|
180 |
-
"name": "num_inference_steps",
|
181 |
-
"paramType": "fixed",
|
182 |
-
"value": "4",
|
183 |
-
"type": "float"
|
184 |
-
}
|
185 |
-
],
|
186 |
-
"outputComponent": "image",
|
187 |
-
"outputComponentIdx": 0,
|
188 |
-
"showOutput": true
|
189 |
-
},
|
190 |
-
{
|
191 |
-
"_id": "000000000000000000000002",
|
192 |
-
"displayName": "Document Parser",
|
193 |
-
"description": "Use this tool to parse any document and get its content in markdown format.",
|
194 |
-
"color": "yellow",
|
195 |
-
"icon": "cloud",
|
196 |
-
"baseUrl": "huggingchat/document-parser",
|
197 |
-
"name": "document_parser",
|
198 |
-
"endpoint": "/predict",
|
199 |
-
"inputs": [
|
200 |
-
{
|
201 |
-
"name": "document",
|
202 |
-
"description": "Filename of the document to parse",
|
203 |
-
"paramType": "required",
|
204 |
-
"type": "file",
|
205 |
-
"mimeTypes": 'application/*'
|
206 |
-
},
|
207 |
-
{
|
208 |
-
"name": "filename",
|
209 |
-
"paramType": "fixed",
|
210 |
-
"value": "document.pdf",
|
211 |
-
"type": "str"
|
212 |
-
}
|
213 |
-
],
|
214 |
-
"outputComponent": "textbox",
|
215 |
-
"outputComponentIdx": 0,
|
216 |
-
"showOutput": false,
|
217 |
-
"isHidden": true
|
218 |
-
},
|
219 |
-
{
|
220 |
-
"_id": "000000000000000000000003",
|
221 |
-
"name": "edit_image",
|
222 |
-
"baseUrl": "multimodalart/cosxl",
|
223 |
-
"endpoint": "/run_edit",
|
224 |
-
"inputs": [
|
225 |
-
{
|
226 |
-
"name": "image",
|
227 |
-
"description": "The image path to be edited",
|
228 |
-
"paramType": "required",
|
229 |
-
"type": "file",
|
230 |
-
"mimeTypes": 'image/*'
|
231 |
-
},
|
232 |
-
{
|
233 |
-
"name": "prompt",
|
234 |
-
"description": "The prompt with which to edit the image",
|
235 |
-
"paramType": "required",
|
236 |
-
"type": "str"
|
237 |
-
},
|
238 |
-
{
|
239 |
-
"name": "negative_prompt",
|
240 |
-
"paramType": "fixed",
|
241 |
-
"value": "",
|
242 |
-
"type": "str"
|
243 |
-
},
|
244 |
-
{
|
245 |
-
"name": "guidance_scale",
|
246 |
-
"paramType": "fixed",
|
247 |
-
"value": 6.5,
|
248 |
-
"type": "float"
|
249 |
-
},
|
250 |
-
{
|
251 |
-
"name": "steps",
|
252 |
-
"paramType": "fixed",
|
253 |
-
"value": 30,
|
254 |
-
"type": "float"
|
255 |
-
}
|
256 |
-
],
|
257 |
-
"outputComponent": "image",
|
258 |
-
"showOutput": true,
|
259 |
-
"displayName": "Image Editor",
|
260 |
-
"color": "green",
|
261 |
-
"icon": "camera",
|
262 |
-
"description": "This tool lets you edit images",
|
263 |
-
"outputComponentIdx": 0
|
264 |
-
}]`
|
265 |
|
266 |
### Rate limits ###
|
267 |
# See `src/lib/server/usageLimits.ts`
|
|
|
138 |
|
139 |
### Tools ###
|
140 |
# Check out public config in `chart/env/prod.yaml` for more details
|
141 |
+
TOOLS=`[]`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
142 |
|
143 |
### Rate limits ###
|
144 |
# See `src/lib/server/usageLimits.ts`
|
src/lib/server/textGeneration/generate.ts
CHANGED
@@ -131,9 +131,12 @@ Do not use prefixes such as Response: or Answer: when answering to the user.`,
|
|
131 |
// simulation of metadata
|
132 |
const durationInSeconds = (new Date().getTime() - startTime.getTime()) / 1000;
|
133 |
|
134 |
-
// LLama 3.1 8B uses 17.38 Wh for 1000 queries according to https://huggingface.co/spaces/AIEnergyScore/Leaderboard
|
135 |
|
136 |
-
const
|
|
|
|
|
|
|
137 |
yield {
|
138 |
type: MessageUpdateType.Metadata,
|
139 |
key: "energy_wh",
|
@@ -145,9 +148,6 @@ Do not use prefixes such as Response: or Answer: when answering to the user.`,
|
|
145 |
value: durationInSeconds,
|
146 |
};
|
147 |
|
148 |
-
console.log('model', model);
|
149 |
-
console.log('output', output);
|
150 |
-
|
151 |
continue;
|
152 |
}
|
153 |
|
|
|
131 |
// simulation of metadata
|
132 |
const durationInSeconds = (new Date().getTime() - startTime.getTime()) / 1000;
|
133 |
|
134 |
+
// LLama 3.1 8B uses 17.38 Wh for 1000 queries according to https://huggingface.co/spaces/AIEnergyScore/Leaderboard
|
135 |
|
136 |
+
const energyUsedwh_sim = +(50 * (durationInSeconds / 3600)).toFixed(6); // Using P = 50W (H100 can use up to 700W)
|
137 |
+
console.log("energyUsedwh_sim", energyUsedwh_sim);
|
138 |
+
const energyUsedwh = (output.energy_consumption / 1000 / 3600).toFixed(6); // converting from mJ to Wh
|
139 |
+
console.log("energyUsedwh", energyUsedwh);
|
140 |
yield {
|
141 |
type: MessageUpdateType.Metadata,
|
142 |
key: "energy_wh",
|
|
|
148 |
value: durationInSeconds,
|
149 |
};
|
150 |
|
|
|
|
|
|
|
151 |
continue;
|
152 |
}
|
153 |
|