Spaces:
Paused
Paused
Download src/limits.ts from Rachit-Tw/PRIX: direct link, hf CLI and curl.
- Browser
- Download file 1.12 kB
-
https://huggingface.co/spaces/Rachit-Tw/PRIX/resolve/refs%2Fpr%2F2/src/limits.ts
- Command line
-
hf download hf://spaces/Rachit-Tw/PRIX@refs/pr/2/src/limits.ts
-
curl -L -o limits.ts https://huggingface.co/spaces/Rachit-Tw/PRIX/resolve/refs%2Fpr%2F2/src/limits.ts
1.12 kB
| export class TokenLimits { | |
| maxTokens: number | |
| requestTokens: number | |
| responseTokens: number | |
| knowledgeCutOff: string | |
| constructor(model = 'llama-3.1-8b-instant') { | |
| this.knowledgeCutOff = '2023-12-01' | |
| // Adjust for Groq TPM/RPM limits on Free/On-Demand tier | |
| if (model.includes('llama-4')) { | |
| this.maxTokens = 29500 | |
| this.responseTokens = 4000 | |
| } else if ( | |
| model.includes('llama-3.1-8b') || | |
| model.includes('llama-3.2-1') || | |
| model.includes('llama-3.1-70b') || | |
| model.includes('llama-3.3-70b') | |
| ) { | |
| // Groq limits are ~6k TPM for 8b and ~12k TPM for 70b | |
| this.maxTokens = model.includes('8b') ? 5500 : 11500 | |
| this.responseTokens = 2000 // Reserve less for response to allow more context | |
| } else { | |
| this.maxTokens = 128000 | |
| this.responseTokens = 16000 | |
| } | |
| // Provide some margin | |
| this.requestTokens = this.maxTokens - this.responseTokens - 500 | |
| } | |
| string(): string { | |
| return `max_tokens=${this.maxTokens}, request_tokens=${this.requestTokens}, response_tokens=${this.responseTokens}` | |
| } | |
| } | |