Spaces:
Sleeping
Sleeping
Download src/lib/viewOptions.ts from joeddav/illustrated-cluster: direct link, hf CLI and curl.
- Browser
- Download file 1.2 kB
-
https://huggingface.co/spaces/joeddav/illustrated-cluster/resolve/main/src/lib/viewOptions.ts
- Command line
-
hf download hf://spaces/joeddav/illustrated-cluster/src/lib/viewOptions.ts
-
curl -L -o viewOptions.ts https://huggingface.co/spaces/joeddav/illustrated-cluster/resolve/main/src/lib/viewOptions.ts
1.2 kB
| import { | |
| getScenarioWorkbenchConfig, | |
| type WorkbenchConfig, | |
| type WorkbenchScenarioId, | |
| } from './workbench' | |
| export type ViewOptions = { | |
| debug: boolean | |
| snapshot: boolean | |
| scenario: WorkbenchScenarioId | |
| } | |
| const SCENARIOS = new Set<WorkbenchScenarioId>([ | |
| 'default', | |
| 'olmo-pretraining', | |
| 'olmo-long-context', | |
| 'llama-pretraining', | |
| 'llama-long-context', | |
| 'trinity-pretraining', | |
| 'trinity-long-context', | |
| 'infeasible-memory', | |
| ]) | |
| const truthyValues = new Set(['1', 'true', 'yes', 'on']) | |
| function isTruthy(value: string | null) { | |
| if (value === null) { | |
| return false | |
| } | |
| return truthyValues.has(value.toLowerCase()) | |
| } | |
| export function getViewOptions(search = window.location.search): ViewOptions { | |
| const params = new URLSearchParams(search) | |
| const scenarioParam = params.get('scenario') | |
| const scenario = SCENARIOS.has(scenarioParam as WorkbenchScenarioId) | |
| ? (scenarioParam as WorkbenchScenarioId) | |
| : 'default' | |
| return { | |
| debug: isTruthy(params.get('debug')), | |
| snapshot: isTruthy(params.get('snapshot')), | |
| scenario, | |
| } | |
| } | |
| export function getScenarioConfig(scenario: WorkbenchScenarioId): WorkbenchConfig { | |
| return getScenarioWorkbenchConfig(scenario) | |
| } | |