Spaces:
Running on Zero
Running on Zero
Allow GPU duration hook to receive tools
Browse files
app.py
CHANGED
|
@@ -63,7 +63,12 @@ def _bounded_output_tokens(value: float) -> int:
|
|
| 63 |
return max(1, min(requested, MAX_NEW_TOKENS))
|
| 64 |
|
| 65 |
|
| 66 |
-
def _gpu_duration(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 67 |
"""Reserve only the GPU time that the requested output can plausibly use."""
|
| 68 |
output_tokens = _bounded_output_tokens(max_new_tokens)
|
| 69 |
return min(120, max(30, 20 + math.ceil(output_tokens * 0.08)))
|
|
|
|
| 63 |
return max(1, min(requested, MAX_NEW_TOKENS))
|
| 64 |
|
| 65 |
|
| 66 |
+
def _gpu_duration(
|
| 67 |
+
_: str,
|
| 68 |
+
__: float,
|
| 69 |
+
max_new_tokens: float,
|
| 70 |
+
*_tools: object,
|
| 71 |
+
) -> int:
|
| 72 |
"""Reserve only the GPU time that the requested output can plausibly use."""
|
| 73 |
output_tokens = _bounded_output_tokens(max_new_tokens)
|
| 74 |
return min(120, max(30, 20 + math.ceil(output_tokens * 0.08)))
|