Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Studio: add Server default for vLLM Min P (#10623)

Etherl14a2545be5af
diff --git a/studio/backend/routes/chat_history.py b/studio/backend/routes/chat_history.py
index 6ada14ba102..ffaf8bc69a5 100644
--- a/studio/backend/routes/chat_history.py
+++ b/studio/backend/routes/chat_history.py
@@ -152,6 +152,7 @@ class ChatThreadSettings(BaseModel):
# -1 disables top-k, matching ChatCompletionRequest and the default.yaml fallback.
topK: Optional[int] = Field(default = None, ge = -1, le = 100)
minP: Optional[float] = Field(default = None, ge = 0, le = 1)
+ minPMode: Optional[Literal["server-default", "custom"]] = None
repetitionPenalty: Optional[float] = Field(default = None, ge = 1, le = 2)
presencePenalty: Optional[float] = Field(default = None, ge = 0, le = 2)
seed: SamplingSeed = None
@@ -385,6 +386,7 @@ class ChatInferenceSettings(BaseModel):
topP: Optional[float] = None
topK: Optional[float] = None
minP: Optional[float] = None
+ minPMode: Optional[Literal["server-default", "custom"]] = None
repetitionPenalty: Optional[float] = None
presencePenalty: Optional[float] = None
maxSeqLength: Optional[float] = None
diff --git a/studio/backend/tests/test_min_p_mode_settings.py b/studio/backend/tests/test_min_p_mode_settings.py
new file mode 100644
index 00000000000..01fbe733cd8
--- /dev/null
+++ b/studio/backend/tests/test_min_p_mode_settings.py
@@ -0,0 +1,25 @@
+# SPDX-License-Identifier: AGPL-3.0-only
+# Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
+
+import pytest
+
+from routes import chat_history
+
+
[email protected]("mode", [None, "server-default", "custom"])
[email protected]("value", [0, 0.01])
+def test_min_p_mode_round_trip_and_numeric_patch(mode, value):
+ params = {"minP": value, **({"minPMode": mode} if mode else {})}
+ payload = {
+ "inferenceParams": params,
+ "inferenceParamsByModel": {"model": params},
+ "customPresets": [{"name": "Saved", "params": params}],
+ }
+ chat_history.put_settings(payload, current_subject = "test")
+ assert chat_history.get_settings(current_subject = "test").settings == payload
+ assert chat_history.ChatThreadSettings(**params).model_dump(exclude_unset = True) == params
+ chat_history.put_settings({"inferenceParams": {"minP": 0.2}}, current_subject = "test")
+ assert chat_history.get_settings(current_subject = "test").settings["inferenceParams"] == {
+ **params,
+ "minP": 0.2,
+ }
diff --git a/studio/frontend/src/features/chat/api/chat-adapter.ts b/studio/frontend/src/features/chat/api/chat-adapter.ts
index 58e764d9784..8de48344672 100644
--- a/studio/frontend/src/features/chat/api/chat-adapter.ts
+++ b/studio/frontend/src/features/chat/api/chat-adapter.ts
@@ -2,6 +2,12 @@
// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
import { mlxRuntimeStateFrom } from "../lib/mlx-runtime-state";
+import { minPSamplingPayload } from "../lib/min-p-policy";
+import {
+ createMinPRecoveryGuard,
+ invalidateMinPRecoveries,
+ shouldOfferMinPRecovery,
+} from "../lib/min-p-recovery";
import {
clearedServerTuningState,
committedServerTuningState,
@@ -5603,6 +5609,35 @@ export function createOpenAIStreamAdapter(
// Stop handle for when this conversation is not the visible one, which cancelByThreadId
// cannot reach. For an external provider the abort IS the stop: no cancel_id is registered.
runtime.registerThreadServerCancel(threadKey, serverCancel);
+ const recoveryState = useChatRuntimeStore.getState();
+ const minPRecoveryGuard =
+ externalProvider?.providerType === "vllm" &&
+ recoveryState.activeThreadId === (resolvedThreadId ?? null) &&
+ recoveryState.params.checkpoint === params.checkpoint &&
+ recoveryState.params.minP === params.minP &&
+ recoveryState.params.minPMode === params.minPMode
+ ? createMinPRecoveryGuard(
+ () => {
+ const state = useChatRuntimeStore.getState();
+ const connections = useExternalProvidersStore.getState();
+ return [
+ state.activeThreadId,
+ state.params,
+ connections.providers,
+ connections.connectionsEnabled,
+ ];
+ },
+ (check) => {
+ const stopSettings = useChatRuntimeStore.subscribe(check);
+ const stopConnections = useExternalProvidersStore.subscribe(check);
+ return () => {
+ stopSettings();
+ stopConnections();
+ };
+ },
+ )
+ : null;
+ let keepMinPRecovery = false;
try {
if (runSignal.aborted) {
onAbortCancel();
@@ -5859,7 +5894,9 @@ export function createOpenAIStreamAdapter(
? { thread_id: resolvedThreadId }
: {}),
...(externalCapabilities?.topK ? { top_k: params.topK } : {}),
- ...(externalCapabilities?.minP ? { min_p: params.minP } : {}),
+ ...(externalCapabilities?.minP
+ ? minPSamplingPayload(externalProvider?.providerType, params)
+ : {}),
...(externalCapabilities?.repetitionPenalty
? { repetition_penalty: params.repetitionPenalty }
: {}),
@@ -7756,7 +7793,40 @@ export function createOpenAIStreamAdapter(
);
if (!runSignal.aborted) {
const msg = err instanceof Error ? err.message : String(err);
- if (err instanceof GenerationLengthError) {
+ if (
+ minPRecoveryGuard?.isValid() &&
+ shouldOfferMinPRecovery(msg, externalProvider?.providerType, params)
+ ) {
+ keepMinPRecovery = true;
+ const cleanupTimer = setTimeout(
+ () => minPRecoveryGuard.dispose(),
+ 8000,
+ );
+ const disposeRecovery = () => {
+ clearTimeout(cleanupTimer);
+ minPRecoveryGuard.dispose();
+ };
+ toast.error("Min P is incompatible with speculative decoding", {
+ description: `This server requires Min P to be disabled. Set it to 0, then retry. ${msg}`,
+ duration: 8000,
+ action: {
+ label: "Set Min P to 0",
+ onClick: () => {
+ const valid = minPRecoveryGuard.isValid();
+ disposeRecovery();
+ if (valid) {
+ const state = useChatRuntimeStore.getState();
+ state.setParams(
+ { ...state.params, minPMode: "custom", minP: 0 },
+ { minPChoiceEdited: true },
+ );
+ }
+ },
+ },
+ onDismiss: disposeRecovery,
+ onAutoClose: disposeRecovery,
+ });
+ } else if (err instanceof GenerationLengthError) {
toast.error("Response ran out of tokens", {
// The error already chose between the Max Tokens and Context Length remedies; repeating the
// Max Tokens advice here overrode that choice in the one place the user reads.
@@ -7881,6 +7951,7 @@ export function createOpenAIStreamAdapter(
}
throw err;
} finally {
+ if (!keepMinPRecovery) minPRecoveryGuard?.dispose();
// Unconditional, and both ids: the pre-admission claim uses `cancelId`, and a run left
// claimed after its stream died would never be recovered.
releaseLiveGenerationRun(cancelId);
@@ -7938,6 +8009,7 @@ export function createOpenAIStreamAdapter(
} satisfies ChatModelAdapter;
return {
async *run(args) {
+ invalidateMinPRecoveries();
const preStreamThreadIds = preStreamRunThreadIdsForAdapter(
args.unstable_threadId,
useChatRuntimeStore.getState().activeThreadId,
diff --git a/studio/frontend/src/features/chat/chat-settings-sheet.tsx b/studio/frontend/src/features/chat/chat-settings-sheet.tsx
index 1fc3eb2e607..bf110c666f7 100644
--- a/studio/frontend/src/features/chat/chat-settings-sheet.tsx
+++ b/studio/frontend/src/features/chat/chat-settings-sheet.tsx
@@ -80,7 +80,8 @@ import {
import {
BUILTIN_PRESETS,
BUILTIN_PRESET_NAMES,
- applyPresetParams,
+ type Preset,
+ applyPresetForProvider,
getBuiltinVariantName,
getOrderedPresets,
getPresetSaveState,
@@ -114,6 +115,8 @@ import {
type InferenceParams,
} from "./types/runtime";
+import { effectiveMinPMode, isMinPMode } from "./lib/min-p-policy";
+
export { defaultInferenceParams, type Preset } from "./presets/preset-policy";
export type { InferenceParams } from "./types/runtime";
@@ -387,7 +390,10 @@ interface ChatSettingsPanelProps {
open: boolean;
onOpenChange?: (open: boolean) => void;
params: InferenceParams;
- onParamsChange: (params: InferenceParams) => void;
+ onParamsChange: (
+ params: InferenceParams,
+ options?: { minPChoiceEdited?: boolean },
+ ) => void;
modelConfig?: ReactNode;
isExternalModel?: boolean;
/** Sampling-param capabilities for the active external provider, or `null` for local models
@@ -478,6 +484,7 @@ export function ChatSettingsPanel({
!isExternalModel || Boolean(providerCapabilities?.temperature);
const showTopP = !isExternalModel || Boolean(providerCapabilities?.topP);
const showTopK = !isExternalModel || Boolean(providerCapabilities?.topK);
+ const isVllm = isExternalModel && externalProviderType === "vllm";
const showMinP = !isExternalModel || Boolean(providerCapabilities?.minP);
const showRepetitionPenalty =
!isExternalModel || Boolean(providerCapabilities?.repetitionPenalty);
@@ -805,12 +812,18 @@ export function ChatSettingsPanel({
function set<K extends keyof InferenceParams>(key: K) {
return (v: InferenceParams[K]) => {
- const nextParams = { ...params, [key]: v };
+ const nextParams = {
+ ...params,
+ [key]: v,
+ ...(key === "minP" ? { minPMode: "custom" as const } : {}),
+ };
const nextSource = isSamePresetConfig(activePresetBaseline, nextParams)
? getPresetSource(activePreset)
: "modified";
setActivePresetSource(nextSource);
- onParamsChange(nextParams);
+ onParamsChange(nextParams, {
+ minPChoiceEdited: key === "minP" || key === "minPMode",
+ });
};
}
@@ -849,9 +862,9 @@ export function ChatSettingsPanel({
]);
function applyPresetParamsWithinCurrentLimits(
- presetParams: Parameters<typeof applyPresetParams>[1],
+ preset: Preset,
): InferenceParams {
- const nextParams = applyPresetParams(params, presetParams);
+ const nextParams = applyPresetForProvider(params, preset, isVllm ? "vllm" : null);
// Same reason the effect waits for a provider: without one `maxTokensMax` is the fallback, so
// applying a preset here would lower the value for good.
if (!isExternalModel || activeExternalProvider == null) return nextParams;
@@ -867,7 +880,9 @@ export function ChatSettingsPanel({
}
const p = presets.find((pr) => pr.name === name);
if (p) {
- onParamsChange(applyPresetParamsWithinCurrentLimits(p.params));
+ onParamsChange(applyPresetParamsWithinCurrentLimits(p), {
+ minPChoiceEdited: true,
+ });
if (p.loadConfig) {
applyPresetLoadConfig(p.loadConfig);
}
@@ -928,7 +943,8 @@ export function ChatSettingsPanel({
if (activePreset === name) {
if (fallbackPreset) {
onParamsChange(
- applyPresetParamsWithinCurrentLimits(fallbackPreset.params),
+ applyPresetParamsWithinCurrentLimits(fallbackPreset),
+ { minPChoiceEdited: true },
);
if (fallbackPreset.loadConfig) {
applyPresetLoadConfig(fallbackPreset.loadConfig);
@@ -1467,15 +1483,45 @@ export function ChatSettingsPanel({
/>
) : null}
{showMinP ? (
- <ParamSlider
- label="Min P"
- value={params.minP}
- min={0}
- max={1}
- step={0.01}
- onChange={set("minP")}
- info="Drops tokens whose probability is below this fraction of the top token's probability. Filters unlikely candidates."
- />
+ <div className="space-y-3">
+ {isVllm ? (
+ <div className="space-y-2">
+ <Select
+ value={effectiveMinPMode(params)}
+ onValueChange={(value) => {
+ if (isMinPMode(value)) set("minPMode")(value);
+ }}
+ >
+ <SelectTrigger aria-label="Min P mode" className="w-full">
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ <SelectItem value="server-default">
+ Server default
+ </SelectItem>
+ <SelectItem value="custom">Custom</SelectItem>
+ </SelectContent>
+ </Select>
+ {effectiveMinPMode(params) === "server-default" ? (
+ <p className="text-xs text-muted-foreground">
+ Uses the server’s sampling settings.
+ </p>
+ ) : null}
+ </div>
+ ) : null}
+ <ParamSlider
+ label="Min P"
+ value={params.minP}
+ disabled={
+ isVllm && effectiveMinPMode(params) === "server-default"
+ }
+ min={0}
+ max={1}
+ step={0.01}
+ onChange={set("minP")}
+ info="Drops tokens whose probability is below this fraction of the top token's probability. Filters unlikely candidates."
+ />
+ </div>
) : null}
{showRepetitionPenalty ? (
<ParamSlider
diff --git a/studio/frontend/src/features/chat/lib/min-p-policy.ts b/studio/frontend/src/features/chat/lib/min-p-policy.ts
new file mode 100644
index 00000000000..3f948847d6a
--- /dev/null
+++ b/studio/frontend/src/features/chat/lib/min-p-policy.ts
@@ -0,0 +1,38 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
+
+import type { MinPMode, PersistedInferenceParams } from "../types/runtime";
+
+export function isMinPMode(value: unknown): value is MinPMode {
+ return value === "server-default" || value === "custom";
+}
+
+/** Only call on saved records, before merging runtime defaults or partial edits. */
+export function normalizeSavedMinP<T extends PersistedInferenceParams>(
+ params: T,
+): T {
+ if (
+ isMinPMode(params.minPMode) ||
+ typeof params.minP !== "number" ||
+ !Number.isFinite(params.minP)
+ ) {
+ return params;
+ }
+ return { ...params, minPMode: "custom" };
+}
+
+export function effectiveMinPMode(
+ params: Pick<PersistedInferenceParams, "minPMode">,
+): MinPMode {
+ return params.minPMode ?? "server-default";
+}
+
+export function minPSamplingPayload(
+ providerType: string | null | undefined,
+ params: { minP: number; minPMode?: MinPMode },
+): { min_p?: number } {
+ return providerType === "vllm" &&
+ effectiveMinPMode(params) === "server-default"
+ ? {}
+ : { min_p: params.minP };
+}
diff --git a/studio/frontend/src/features/chat/lib/min-p-recovery.ts b/studio/frontend/src/features/chat/lib/min-p-recovery.ts
new file mode 100644
index 00000000000..8eb62cf2e70
--- /dev/null
+++ b/studio/frontend/src/features/chat/lib/min-p-recovery.ts
@@ -0,0 +1,60 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
+
+import { effectiveMinPMode } from "./min-p-policy";
+import type { MinPMode } from "../types/runtime";
+
+const rejection =
+ "The min_p and logit_bias sampling parameters are not yet supported with speculative decoding";
+
+export function shouldOfferMinPRecovery(
+ message: string,
+ providerType: string | undefined,
+ params: { minP: number; minPMode?: MinPMode },
+): boolean {
+ return (
+ providerType === "vllm" &&
+ message.includes(rejection) &&
+ !(effectiveMinPMode(params) === "custom" && params.minP === 0)
+ );
+}
+
+const pendingGuards = new Set<() => void>();
+
+/** A newer send supersedes an old error action, even if its settings are identical. */
+export function invalidateMinPRecoveries(): void {
+ for (const invalidate of pendingGuards) invalidate();
+}
+
+export function createMinPRecoveryGuard(
+ readContext: () => readonly unknown[],
+ subscribe: (listener: () => void) => () => void,
+) {
+ const original = readContext();
+ let valid = true;
+ const invalidate = () => {
+ valid = false;
+ };
+ const check = () => {
+ const current = readContext();
+ if (
+ current.length !== original.length ||
+ current.some((value, index) => !Object.is(value, original[index]))
+ )
+ invalidate();
+ return valid;
+ };
+ pendingGuards.add(invalidate);
+ const unsubscribe = subscribe(check);
+ let disposed = false;
+ return {
+ isValid: check,
+ dispose() {
+ if (disposed) return;
+ disposed = true;
+ invalidate();
+ pendingGuards.delete(invalidate);
+ unsubscribe();
+ },
+ };
+}
diff --git a/studio/frontend/src/features/chat/lib/per-model-params.ts b/studio/frontend/src/features/chat/lib/per-model-params.ts
index 034048127ce..ae9282f9d0f 100644
--- a/studio/frontend/src/features/chat/lib/per-model-params.ts
+++ b/studio/frontend/src/features/chat/lib/per-model-params.ts
@@ -10,6 +10,8 @@ import type {
PersistedInferenceParams,
} from "../types/runtime";
+import { normalizeSavedMinP } from "./min-p-policy.ts";
+
export type PersistedInferenceParamKey = keyof PersistedInferenceParams;
/** Params that persist across a reload. `checkpoint` is the key, not a value. */
@@ -18,6 +20,7 @@ export const PERSISTED_INFERENCE_PARAM_KEYS = [
"topP",
"topK",
"minP",
+ "minPMode",
"repetitionPenalty",
"presencePenalty",
"maxSeqLength",
@@ -118,7 +121,8 @@ export function getReplayedParams(
if (!(enabled && checkpointChanged)) {
return capped(current);
}
- const remembered = paramsByModel[modelId];
+ const saved = paramsByModel[modelId];
+ const remembered = saved ? normalizeSavedMinP(saved) : undefined;
if (!remembered) {
return capped(current);
}
diff --git a/studio/frontend/src/features/chat/presets/preset-policy.ts b/studio/frontend/src/features/chat/presets/preset-policy.ts
index 01fe98f801e..cc86c14905e 100644
--- a/studio/frontend/src/features/chat/presets/preset-policy.ts
+++ b/studio/frontend/src/features/chat/presets/preset-policy.ts
@@ -5,6 +5,7 @@ import {
DEFAULT_INFERENCE_PARAMS,
type InferenceParams,
} from "../types/runtime";
+import { effectiveMinPMode } from "../lib/min-p-policy.ts";
import type { PresetLoadConfig } from "./preset-load-config";
export const defaultInferenceParams = DEFAULT_INFERENCE_PARAMS;
@@ -25,6 +26,7 @@ export type PresetOwnedParams = Pick<
| "topP"
| "topK"
| "minP"
+ | "minPMode"
| "repetitionPenalty"
| "presencePenalty"
| "maxTokens"
@@ -110,6 +112,7 @@ export function getPresetOwnedParams(
topP: params.topP,
topK: params.topK,
minP: params.minP,
+ minPMode: effectiveMinPMode(params),
repetitionPenalty: params.repetitionPenalty,
presencePenalty: params.presencePenalty,
maxTokens: params.maxTokens,
@@ -131,6 +134,7 @@ export function isSamePresetConfig(
left.topP === right.topP &&
left.topK === right.topK &&
left.minP === right.minP &&
+ left.minPMode === right.minPMode &&
left.repetitionPenalty === right.repetitionPenalty &&
left.presencePenalty === right.presencePenalty &&
left.maxTokens === right.maxTokens &&
@@ -161,6 +165,20 @@ export function applyPresetParams(
};
}
+/** Built-in reset delegates on vLLM; other providers keep their dormant choice. */
+export function applyPresetForProvider(
+ current: InferenceParams,
+ preset: Preset,
+ providerType: string | null | undefined,
+): InferenceParams {
+ const applied = applyPresetParams(current, preset.params);
+ if (preset.name !== "Default") return applied;
+ return {
+ ...applied,
+ minPMode: providerType === "vllm" ? "server-default" : effectiveMinPMode(current),
+ };
+}
+
export type PresetSaveMode =
| "disabled"
| "overwrite-active"
diff --git a/studio/frontend/src/features/chat/stores/chat-runtime-store.ts b/studio/frontend/src/features/chat/stores/chat-runtime-store.ts
index 706b2301f2b..ed077816ebd 100644
--- a/studio/frontend/src/features/chat/stores/chat-runtime-store.ts
+++ b/studio/frontend/src/features/chat/stores/chat-runtime-store.ts
@@ -60,6 +60,7 @@ import {
} from "../types/runtime";
import {
loadChatSettingsWithLegacyImport,
+ normalizeSavedChatSettings,
sanitizeChatSettings,
savePersistedChatSettingsPatch,
savePersistedChatSettingsPatchIfCurrent,
@@ -92,6 +93,7 @@ import {
hasThreadScopedSettings,
isThreadOwnedSettingKey,
isThreadScopedParamKey,
+ normalizeSavedThreadScopedSettings,
sanitizeThreadScopedSettings,
} from "../utils/thread-scoped-settings";
import {
@@ -2453,6 +2455,8 @@ type ChatRuntimeStore = {
options?: {
persist?: boolean;
trackQueuedSettings?: boolean;
+ /** An explicit Min P action fences the pair even when the number did not move. */
+ minPChoiceEdited?: boolean;
/** These params are the model's defaults, so its remembered settings are laid back over them
* even with no checkpoint change; being the model's, they move the installation defaults. */
fromModelDefaults?: boolean;
@@ -2722,9 +2726,23 @@ const SCALAR_SETTING_KEYS = [
// Ids this browser holds a local answer for. Hydration keeps these and merges the rest, so a
// pre-hydration edit cannot drop other models.
const locallyRememberedModels = new Set<string>();
-const inferenceParamMutationVersions = Object.fromEntries(
- PERSISTED_INFERENCE_PARAM_KEYS.map((key) => [key, 0]),
-) as Record<PersistedInferenceParamKey, number>;
+/** Deferred, not module scope: per-model-params is in the @/features/chat import cycle, so
+ * naming PERSISTED_INFERENCE_PARAM_KEYS here reads a const in its TDZ and throws at import
+ * time (as watchedStorageKeys() avoids). Memoized, or the `+= 1` bumps stop accumulating. */
+let inferenceParamMutationVersionsCache: Record<
+ PersistedInferenceParamKey,
+ number
+> | null = null;
+
+function inferenceParamMutationVersions(): Record<
+ PersistedInferenceParamKey,
+ number
+> {
+ inferenceParamMutationVersionsCache ??= Object.fromEntries(
+ PERSISTED_INFERENCE_PARAM_KEYS.map((key) => [key, 0]),
+ ) as Record<PersistedInferenceParamKey, number>;
+ return inferenceParamMutationVersionsCache;
+}
const scalarSettingMutationVersions = Object.fromEntries(
SCALAR_SETTING_KEYS.map((key) => [key, 0]),
) as Record<ScalarSettingKey, number>;
@@ -2778,7 +2796,7 @@ function hasKeys(value: object): boolean {
function getSettingsHydrationVersions(): SettingsHydrationVersions {
return {
- inferenceParams: { ...inferenceParamMutationVersions },
+ inferenceParams: { ...inferenceParamMutationVersions() },
scalarSettings: { ...scalarSettingMutationVersions },
presets: {
customPresets: customPresetsMutationVersion,
@@ -2834,20 +2852,34 @@ function getChangedInferenceParams(
nextParams: InferenceParams,
currentParams: InferenceParams,
bumpVersions = true,
+ minPChoiceEdited = false,
): PersistedInferenceParams {
const changedParams: PersistedInferenceParams = {};
+ // Mode and number are one choice: fence the pair even if only the mode moved.
+ const minPChoiceChanged =
+ bumpVersions &&
+ (minPChoiceEdited ||
+ !Object.is(nextParams.minP, currentParams.minP) ||
+ !Object.is(nextParams.minPMode, currentParams.minPMode));
for (const key of PERSISTED_INFERENCE_PARAM_KEYS) {
const nextValue = nextParams[key];
- if (Object.is(nextValue, currentParams[key])) {
+ if (
+ Object.is(nextValue, currentParams[key]) &&
+ !(minPChoiceChanged && (key === "minP" || key === "minPMode"))
+ ) {
continue;
}
if (bumpVersions) {
- inferenceParamMutationVersions[key] += 1;
+ inferenceParamMutationVersions()[key] += 1;
}
if (nextValue !== undefined) {
setInferenceParam(changedParams as InferenceParams, key, nextValue);
}
}
+ // A written number carries its mode, or the next read reads it as legacy intent.
+ if (changedParams.minP !== undefined && nextParams.minPMode !== undefined) {
+ changedParams.minPMode = nextParams.minPMode;
+ }
return changedParams;
}
@@ -2982,6 +3014,7 @@ function getHydratedCustomPresets(
settings: PersistedChatSettings,
state: ChatRuntimeStore,
): Preset[] {
+ settings = normalizeSavedChatSettings(settings);
return (
settings.customPresets?.map((preset) => {
const loadConfig = normalizePresetLoadConfig(preset.loadConfig);
@@ -3034,7 +3067,7 @@ function pickLocallyEditedParams(
): PersistedInferenceParams {
const edited: PersistedInferenceParams = {};
for (const key of REMEMBERED_INFERENCE_PARAM_KEYS) {
- if (inferenceParamMutationVersions[key] !== versions.inferenceParams[key]) {
+ if (inferenceParamMutationVersions()[key] !== versions.inferenceParams[key]) {
setInferenceParam(edited as InferenceParams, key, params[key]);
}
}
@@ -3130,6 +3163,8 @@ function getHydratedSettingsState(
state: ChatRuntimeStore,
versions: SettingsHydrationVersions,
): Partial<ChatRuntimeStore> {
+ // A migration's confirming read stays raw for CAS; normalize only on hydration.
+ settings = normalizeSavedChatSettings(settings);
const nextState: Partial<ChatRuntimeStore> = {};
const checkpoint = state.params.checkpoint;
const loadedBeforeHydration = sameCheckpointIdentity(
@@ -3165,7 +3200,7 @@ function getHydratedSettingsState(
// The context belongs to the load, not the previous model's global set, and no entry carries
// one for the replay below.
!(loadedBeforeHydration && key === "maxSeqLength") &&
- inferenceParamMutationVersions[key] === versions.inferenceParams[key]
+ inferenceParamMutationVersions()[key] === versions.inferenceParams[key]
) {
setInferenceParam(params, key, value);
}
@@ -3314,7 +3349,7 @@ function getHydratedSettingsState(
const value = remembered[key];
if (
value !== undefined &&
- inferenceParamMutationVersions[key] === versions.inferenceParams[key]
+ inferenceParamMutationVersions()[key] === versions.inferenceParams[key]
) {
setInferenceParam(replayed, key, value);
}
@@ -3594,7 +3629,7 @@ function adoptMigratedFieldsAfterLocalEdit(
const field = key as PersistedInferenceParamKey;
if (
versionsBefore[field] === undefined ||
- inferenceParamMutationVersions[field] !== versionsBefore[field] ||
+ inferenceParamMutationVersions()[field] !== versionsBefore[field] ||
nextParams[field] === value
) {
continue;
@@ -3686,7 +3721,7 @@ async function retryLegacyQwenDefaultsAfterPresetChange(
// Captured before the write: an edit landing mid-flight is the one case
// where the server takes the migration and local refuses it.
const presetSourceBeforeWrite = activePresetSourceMutationVersion;
- const paramVersionsBeforeWrite = { ...inferenceParamMutationVersions };
+ const paramVersionsBeforeWrite = { ...inferenceParamMutationVersions() };
const persisted = await savePersistedChatSettingsPatchIfCurrent(
confirmed,
migration.patch,
@@ -4266,10 +4301,14 @@ export const useChatRuntimeStore = create<ChatRuntimeStore>((set, get) => ({
// setCheckpoint only later, so replay here or the switch never restores the model's own settings.
noteLoadedContext(params.checkpoint, options?.maxTokensCap);
const replayed = checkpointChanged || fromModelDefaults;
+ // A recommendation carries no mode, and the live one may belong to the thread.
+ const incomingParams = fromModelDefaults
+ ? { ...params, minPMode: withoutActiveThreadParams(state, params).minPMode }
+ : params;
const nextParams = getReplayedParams(
state.rememberParamsPerModel,
outgoing ?? state.paramsByModel,
- params,
+ incomingParams,
params.checkpoint,
replayed,
options?.maxTokensCap,
@@ -4285,12 +4324,15 @@ export const useChatRuntimeStore = create<ChatRuntimeStore>((set, get) => ({
nextParams,
state.params,
!fromModelDefaults,
+ options?.minPChoiceEdited === true,
);
- const queuedSettingsChanged = shouldAdvanceQueuedSettingsEpoch(
- state.params,
- effective,
- options?.trackQueuedSettings !== false,
- );
+ const queuedSettingsChanged =
+ options?.minPChoiceEdited === true ||
+ shouldAdvanceQueuedSettingsEpoch(
+ state.params,
+ effective,
+ options?.trackQueuedSettings !== false,
+ );
const persistingGlobally =
options?.persist !== false && state.settingsHydrated;
// A sampling key moved with a chat open belongs to that chat, so it reaches neither the defaults nor
@@ -4642,6 +4684,7 @@ export const useChatRuntimeStore = create<ChatRuntimeStore>((set, get) => ({
})),
applyThreadScopedSettings: (threadId, settings) =>
set((state) => {
+ settings = normalizeSavedThreadScopedSettings(settings);
// The pending write belongs to the outgoing thread, so it goes out before the swap.
flushThreadScopedSettingsWrite();
// Edits made while this chat's snapshot was in flight: keep them and store them on the chat,
diff --git a/studio/frontend/src/features/chat/types/runtime.ts b/studio/frontend/src/features/chat/types/runtime.ts
index 9e77125d407..0cdc58f3e83 100644
--- a/studio/frontend/src/features/chat/types/runtime.ts
+++ b/studio/frontend/src/features/chat/types/runtime.ts
@@ -1,11 +1,14 @@
// SPDX-License-Identifier: AGPL-3.0-only
// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
+export type MinPMode = "server-default" | "custom";
+
export interface InferenceParams {
temperature: number;
topP: number;
topK: number;
minP: number;
+ minPMode?: MinPMode;
repetitionPenalty: number;
presencePenalty: number;
maxSeqLength: number;
@@ -61,6 +64,7 @@ export const DEFAULT_INFERENCE_PARAMS: InferenceParams = {
topP: 0.95,
topK: 20,
minP: 0.01,
+ minPMode: "server-default",
repetitionPenalty: 1.0,
presencePenalty: 0.0,
maxSeqLength: 4096,
diff --git a/studio/frontend/src/features/chat/utils/chat-settings-storage.ts b/studio/frontend/src/features/chat/utils/chat-settings-storage.ts
index f29695e6834..f91478ec073 100644
--- a/studio/frontend/src/features/chat/utils/chat-settings-storage.ts
+++ b/studio/frontend/src/features/chat/utils/chat-settings-storage.ts
@@ -10,6 +10,7 @@ import {
type PersistedChatSettings,
type PersistedInferenceParams,
} from "../api/chat-settings-api";
+import { isMinPMode, normalizeSavedMinP } from "../lib/min-p-policy";
import { normalizePresetLoadConfig } from "../presets/preset-load-config";
import {
BUILTIN_PRESETS,
@@ -144,6 +145,7 @@ function sanitizeInferenceParams(
if (!isRecord(value)) return undefined;
const params: PersistedInferenceParams = {};
+ if (isMinPMode(value.minPMode)) params.minPMode = value.minPMode;
for (const field of NUMERIC_INFERENCE_FIELDS) {
const fieldValue = value[field];
if (typeof fieldValue === "number" && Number.isFinite(fieldValue)) {
@@ -197,7 +199,7 @@ function toFullPreset(preset: PersistedChatPreset): Preset {
name: preset.name,
params: {
...defaultInferenceParams,
- ...preset.params,
+ ...normalizeSavedMinP(preset.params),
checkpoint: defaultInferenceParams.checkpoint,
},
...(loadConfig ? { loadConfig } : {}),
@@ -257,6 +259,29 @@ function sanitizeInt(value: unknown, min: number): number | undefined {
: undefined;
}
+/** Read-only migration; outgoing numeric patches do not imply user intent. */
+export function normalizeSavedChatSettings(value: unknown): PersistedChatSettings {
+ const settings = sanitizeChatSettings(value);
+ if (settings.inferenceParams) {
+ settings.inferenceParams = normalizeSavedMinP(settings.inferenceParams);
+ }
+ if (settings.inferenceParamsByModel) {
+ settings.inferenceParamsByModel = Object.fromEntries(
+ Object.entries(settings.inferenceParamsByModel).map(([id, params]) => [
+ id,
+ normalizeSavedMinP(params),
+ ]),
+ );
+ }
+ if (settings.customPresets) {
+ settings.customPresets = settings.customPresets.map((preset) => ({
+ ...preset,
+ params: normalizeSavedMinP(preset.params),
+ }));
+ }
+ return settings;
+}
+
export function sanitizeChatSettings(value: unknown): PersistedChatSettings {
if (!isRecord(value)) return {};
@@ -453,7 +478,7 @@ export function loadLegacyChatSettings(): PersistedChatSettings {
}
if (toolCallTimeout !== undefined) settings.toolCallTimeout = toolCallTimeout;
- return settings;
+ return normalizeSavedChatSettings(settings);
}
export interface LoadedChatSettings {
@@ -474,7 +499,7 @@ export interface LoadedChatSettings {
export async function loadChatSettingsWithLegacyImport(): Promise<LoadedChatSettings> {
let dbSettings: PersistedChatSettings;
try {
- dbSettings = sanitizeChatSettings(await getChatSettings());
+ dbSettings = normalizeSavedChatSettings(await getChatSettings());
} catch (error) {
const legacySettings = loadLegacyChatSettings();
if (isEmptyChatSettings(legacySettings)) {
@@ -493,7 +518,7 @@ export async function loadChatSettingsWithLegacyImport(): Promise<LoadedChatSett
}
try {
return {
- settings: sanitizeChatSettings(
+ settings: normalizeSavedChatSettings(
await saveChatSettingsPatch(legacySettings),
),
fromServer: true,
@@ -519,7 +544,7 @@ export async function loadChatSettingsWithLegacyImport(): Promise<LoadedChatSett
},
};
try {
- const savedSettings = sanitizeChatSettings(
+ const savedSettings = normalizeSavedChatSettings(
await saveChatSettingsPatch(mergedSettings),
);
markLegacySettingsImportDone();
@@ -533,7 +558,7 @@ export async function savePersistedChatSettingsPatch(
patch: PersistedChatSettings,
options: { keepalive?: boolean } = {},
): Promise<PersistedChatSettings> {
- return sanitizeChatSettings(
+ return normalizeSavedChatSettings(
await saveChatSettingsPatch(sanitizeChatSettings(patch), options),
);
}
@@ -551,7 +576,7 @@ export async function savePersistedChatSettingsPatchIfCurrent(
expectedAbsentPaths,
);
return {
- settings: sanitizeChatSettings(result.settings),
+ settings: normalizeSavedChatSettings(result.settings),
applied: result.applied,
};
}
diff --git a/studio/frontend/src/features/chat/utils/thread-scoped-settings.ts b/studio/frontend/src/features/chat/utils/thread-scoped-settings.ts
index 13ba314a115..ae791040ea4 100644
--- a/studio/frontend/src/features/chat/utils/thread-scoped-settings.ts
+++ b/studio/frontend/src/features/chat/utils/thread-scoped-settings.ts
@@ -5,6 +5,7 @@
// pills, the permission level, the retrieval controls and the sampling params. Editing one with a
// chat open writes this snapshot onto the thread, and reopening that thread applies it back.
+import { normalizeSavedMinP } from "../lib/min-p-policy.ts";
import type {
PermissionMode,
RagAutoInject,
@@ -12,7 +13,7 @@ import type {
RagSource,
ReasoningEffort,
} from "../stores/chat-runtime-store";
-import { MAX_SAMPLING_SEED } from "../types/runtime.ts";
+import { MAX_SAMPLING_SEED, type MinPMode } from "../types/runtime.ts";
import {
isRecord,
sanitizeBoundedNumber,
@@ -43,6 +44,7 @@ export interface ThreadScopedSettings {
topP?: number;
topK?: number;
minP?: number;
+ minPMode?: MinPMode;
repetitionPenalty?: number;
presencePenalty?: number;
/** null is the cleared pin, and is the only thread-scoped value that is not undefined. */
@@ -57,6 +59,7 @@ export const THREAD_SCOPED_PARAM_KEYS = [
"topP",
"topK",
"minP",
+ "minPMode",
"repetitionPenalty",
"presencePenalty",
"seed",
@@ -89,6 +92,7 @@ const THREAD_SCOPED_BOOLEAN_KEYS = [
] as const satisfies readonly (keyof ThreadScopedSettings)[];
const THREAD_SCOPED_ENUM_VALUES = {
+ minPMode: ["server-default", "custom"],
reasoningEffort: ["none", "minimal", "low", "medium", "high", "max", "xhigh"],
permissionMode: ["ask", "auto", "off"],
ragMode: ["hybrid", "lexical", "dense"],
@@ -202,3 +206,10 @@ export function hasThreadScopedSettings(
if (!settings) return false;
return THREAD_SCOPED_SETTING_KEYS.some((key) => settings[key] !== undefined);
}
+
+/** Normalize original saved snapshots before inheriting current defaults. */
+export function normalizeSavedThreadScopedSettings(
+ value: unknown,
+): ThreadScopedSettings {
+ return normalizeSavedMinP(sanitizeThreadScopedSettings(value));
+}
diff --git a/studio/frontend/tests/external-sampling-payload.test.ts b/studio/frontend/tests/external-sampling-payload.test.ts
index 5b8ebd330a9..791f2f3736f 100644
--- a/studio/frontend/tests/external-sampling-payload.test.ts
+++ b/studio/frontend/tests/external-sampling-payload.test.ts
@@ -16,12 +16,17 @@ registerBundlerResolver();
const { getProviderCapabilities } = await import(
"../src/features/chat/provider-capabilities.ts"
);
+const { minPSamplingPayload } = await import(
+ "../src/features/chat/lib/min-p-policy.ts"
+);
+import type { MinPMode } from "../src/features/chat/types/runtime.ts";
const PARAMS = {
temperature: 0.6,
topP: 0.95,
topK: 40,
minP: 0.07,
+ minPMode: "custom" as MinPMode,
repetitionPenalty: 1.15,
presencePenalty: 0.3,
};
@@ -64,21 +69,45 @@ const gatedSpreads = externalBodyLiteral()
.filter((text) => text.includes("externalCapabilities"));
// Without this, an extraction that matched nothing would pass every assertion vacuously.
-assert.ok(gatedSpreads.length >= 4, `only ${gatedSpreads.length} gated spreads`);
+assert.ok(
+ gatedSpreads.length >= 4,
+ `only ${gatedSpreads.length} gated spreads`,
+);
const buildSamplingFields = new Function(
"externalCapabilities",
"params",
+ "externalProvider",
+ "minPSamplingPayload",
`return Object.assign({}, ${gatedSpreads.join(", ")});`,
) as (
capabilities: unknown,
params: typeof PARAMS,
+ externalProvider: { providerType: string },
+ payload: typeof minPSamplingPayload,
) => Record<string, number>;
-function bodyFor(providerType: string): Record<string, number> {
- return buildSamplingFields(getProviderCapabilities(providerType), PARAMS);
+function bodyFor(
+ providerType: string,
+ params = PARAMS,
+): Record<string, number> {
+ return buildSamplingFields(
+ getProviderCapabilities(providerType),
+ params,
+ { providerType },
+ minPSamplingPayload,
+ );
}
+test("vLLM server default omits Min P while retaining other sampling fields", () => {
+ const custom = bodyFor("vllm");
+ const server = bodyFor("vllm", { ...PARAMS, minPMode: "server-default" });
+ const { min_p, ...other } = custom;
+ assert.equal(min_p, PARAMS.minP);
+ assert.deepEqual(server, other);
+ assert.equal(bodyFor("vllm", { ...PARAMS, minP: 0 }).min_p, 0);
+});
+
for (const providerType of ["vllm", "openrouter", "llama_cpp"]) {
test(`${providerType} carries the min_p and repetition_penalty the panel offers`, () => {
const body = bodyFor(providerType);
@@ -88,6 +117,12 @@ for (const providerType of ["vllm", "openrouter", "llama_cpp"]) {
assert.equal(body.presence_penalty, PARAMS.presencePenalty);
assert.equal(body.temperature, PARAMS.temperature);
assert.equal(body.top_p, PARAMS.topP);
+ if (providerType !== "vllm") {
+ assert.deepEqual(
+ bodyFor(providerType, { ...PARAMS, minPMode: "server-default" }),
+ body,
+ );
+ }
});
}
diff --git a/studio/frontend/tests/min-p-settings-store.test.ts b/studio/frontend/tests/min-p-settings-store.test.ts
new file mode 100644
index 00000000000..1039f7921a5
--- /dev/null
+++ b/studio/frontend/tests/min-p-settings-store.test.ts
@@ -0,0 +1,78 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
+
+import assert from "node:assert/strict";
+import { register } from "node:module";
+import test from "node:test";
+import { installLocalStorageFake } from "./helpers/kit.ts";
+
+installLocalStorageFake().store.set(
+ "unsloth_chat_settings_imported_to_studio_db",
+ "true",
+);
+register("./store-settings-resolver.mjs", import.meta.url);
+const { settingsHttp } = await import("./helpers/store-stubs/settings-http.ts");
+const { useChatRuntimeStore: store } = await import(
+ "../src/features/chat/stores/chat-runtime-store.ts"
+);
+const initialParams = store.getState().params;
+const { shouldOfferMinPRecovery } = await import(
+ "../src/features/chat/lib/min-p-recovery.ts"
+);
+const A = "external::vllm-a::model-a";
+const B = "external::vllm-b::model-b";
+
+function reset(settings: Record<string, unknown> = {}) {
+ settingsHttp.settings = settings;
+ store.setState({
+ params: { ...initialParams, checkpoint: A },
+ paramsByModel: {},
+ rememberParamsPerModel: true,
+ settingsHydrated: false,
+ });
+}
+
+test("fresh settings delegate; saved legacy and explicit modes survive switching", async () => {
+ reset();
+ await store.getState().hydratePersistedSettings();
+ assert.equal(store.getState().params.minPMode, "server-default");
+ reset({
+ inferenceParamsByModel: {
+ [A]: { minP: 0.01 },
+ [B]: { minP: 0, minPMode: "server-default" },
+ },
+ });
+ await store.getState().hydratePersistedSettings();
+ assert.equal(store.getState().params.minPMode, "custom");
+ assert.equal(store.getState().params.minP, 0.01);
+ store.getState().setCheckpoint(B);
+ assert.equal(store.getState().params.minPMode, "server-default");
+ assert.equal(store.getState().params.minP, 0);
+});
+
+test("an explicit zero survives a delayed settings read", async () => {
+ reset({ inferenceParams: { minP: 0.7 } });
+ settingsHttp.hold();
+ const hydrating = store.getState().hydratePersistedSettings();
+ const current = store.getState();
+ current.setParams(
+ { ...current.params, minP: 0, minPMode: "custom" },
+ { minPChoiceEdited: true },
+ );
+ settingsHttp.release?.();
+ await hydrating;
+ assert.equal(store.getState().params.minP, 0);
+ assert.equal(store.getState().params.minPMode, "custom");
+});
+
+test("recovery offers zero for delegation but not an explicit zero", () => {
+ const error =
+ "The min_p and logit_bias sampling parameters are not yet supported with speculative decoding";
+ for (const minPMode of ["server-default", "custom"] as const) {
+ const offered = shouldOfferMinPRecovery(error, "vllm", {
+ minP: 0,
+ minPMode,
+ });
+ assert.equal(offered, minPMode === "server-default");
+ }
+});
diff --git a/studio/frontend/tests/provider-max-output-tokens.test.ts b/studio/frontend/tests/provider-max-output-tokens.test.ts
index f61a376c7b6..039e1a2742e 100644
--- a/studio/frontend/tests/provider-max-output-tokens.test.ts
+++ b/studio/frontend/tests/provider-max-output-tokens.test.ts
@@ -97,11 +97,11 @@ test("preset application clamps live Max Tokens to the active external cap", ()
);
assert.match(
settings,
- /onParamsChange\(applyPresetParamsWithinCurrentLimits\(p\.params\)\)/,
+ /onParamsChange\(applyPresetParamsWithinCurrentLimits\(p\),\s*\{\s*minPChoiceEdited: true,\s*\}\)/,
);
assert.match(
settings,
- /applyPresetParamsWithinCurrentLimits\(fallbackPreset\.params\)/,
+ /onParamsChange\(\s*applyPresetParamsWithinCurrentLimits\(fallbackPreset\),\s*\{ minPChoiceEdited: true \},\s*\)/,
);
});
diff --git a/studio/frontend/tests/qwen-defaults-migration-hydration.test.ts b/studio/frontend/tests/qwen-defaults-migration-hydration.test.ts
index 207461ab5bf..5a122744e86 100644
--- a/studio/frontend/tests/qwen-defaults-migration-hydration.test.ts
+++ b/studio/frontend/tests/qwen-defaults-migration-hydration.test.ts
@@ -447,6 +447,7 @@ test("resident-model adoption migrates a deferred global-only snapshot", async (
(put) => put.inferenceParams !== undefined,
);
assert.deepEqual(globalPut?.inferenceParams, {
+ minPMode: "custom",
minP: 0,
presencePenalty: 1.5,
});
@@ -834,6 +835,7 @@ test("deferred adoption migrates the authoritative global when memory is off", a
(put) => put.inferenceParams !== undefined,
);
assert.deepEqual(globalPatch?.inferenceParams, {
+ minPMode: "custom",
minP: 0,
presencePenalty: 1.5,
});
diff --git a/studio/frontend/tests/qwen-defaults-migration-safety.test.ts b/studio/frontend/tests/qwen-defaults-migration-safety.test.ts
index 7a11a06915d..4479ab84a3c 100644
--- a/studio/frontend/tests/qwen-defaults-migration-safety.test.ts
+++ b/studio/frontend/tests/qwen-defaults-migration-safety.test.ts
@@ -50,9 +50,10 @@ function resetHttp(settings: Record<string, unknown>): void {
/** The store as it stands with the legacy Qwen3.8 snapshot loaded and active. */
function seedActiveQwen(overrides: Record<string, unknown> = {}): void {
+ const hydratedSnapshot = { ...LEGACY_SNAPSHOT, minPMode: "custom" as const };
useChatRuntimeStore.setState((state) => ({
- params: { ...state.params, ...LEGACY_SNAPSHOT, checkpoint: QWEN38 },
- paramsByModel: { [QWEN38]: LEGACY_SNAPSHOT },
+ params: { ...state.params, ...hydratedSnapshot, checkpoint: QWEN38 },
+ paramsByModel: { [QWEN38]: hydratedSnapshot },
activePreset: "Default",
activePresetSource: "builtin-default",
rememberParamsPerModel: true,
diff --git a/studio/frontend/tests/thread-scoped-pairing-invariants.test.ts b/studio/frontend/tests/thread-scoped-pairing-invariants.test.ts
index 1cd8699539e..47fea4b7c72 100644
--- a/studio/frontend/tests/thread-scoped-pairing-invariants.test.ts
+++ b/studio/frontend/tests/thread-scoped-pairing-invariants.test.ts
@@ -714,9 +714,10 @@ test("toggling Think applies its params even in a chat that pins sampling", () =
// installation defaults, leaving every new chat on whatever model loaded before it.
test("a chat pinning a param does not withhold the model's default from the rest", () => {
const setParams = slice(store, "setParams: (params, options)", "\n setCustomPresets:");
+ // The first three arguments are the invariant; later ones may be added.
assert.match(
setParams,
- /getChangedInferenceParams\(\s*nextParams,\s*state\.params,\s*!fromModelDefaults,\s*\)/,
+ /getChangedInferenceParams\(\s*nextParams,\s*state\.params,\s*!fromModelDefaults,(\s*[^)]*,)?\s*\)/,
);
assert.doesNotMatch(
setParams,
diff --git a/tests/python/test_cross_platform_parity.py b/tests/python/test_cross_platform_parity.py
index cc0248eab4f..afb14779cc2 100644
--- a/tests/python/test_cross_platform_parity.py
+++ b/tests/python/test_cross_platform_parity.py
@@ -1264,8 +1264,19 @@ class TestInstallUvCacheRootParity:
# and it decides only the NAME: a colliding file must reach the rejection below.
assert writable_sh.index("_uv_w_fold") < writable_sh.index('[ ! -d "$_uv_w_dir" ]')
probe_kinds = {
- "archive", "binaries", "builds", "built-wheels", "environments", "flat-index",
- "git", "interpreter", "osv", "python", "sdists", "simple", "wheels",
+ "archive",
+ "binaries",
+ "builds",
+ "built-wheels",
+ "environments",
+ "flat-index",
+ "git",
+ "interpreter",
+ "osv",
+ "python",
+ "sdists",
+ "simple",
+ "wheels",
}
assert 'UV_PINNED_VERSION="0.12.1"' in sh, "re-read uv-cache/src/lib.rs for the new pin"
case_body = re.search(
diff --git a/tests/python/test_docker_nvidia_toolkit_install.py b/tests/python/test_docker_nvidia_toolkit_install.py
index 565625e0be8..7e9eac97d37 100644
--- a/tests/python/test_docker_nvidia_toolkit_install.py
+++ b/tests/python/test_docker_nvidia_toolkit_install.py
@@ -588,7 +588,8 @@ def test_a_mac_driving_a_remote_daemon_is_sent_to_that_host(tmp_path: Path):
@pytest.mark.parametrize(
- "endpoint", ["tcp://localhost:2375", "tcp://127.0.0.1:2375", "tcp://[::1]:2375", "localhost:2375"]
+ "endpoint",
+ ["tcp://localhost:2375", "tcp://127.0.0.1:2375", "tcp://[::1]:2375", "localhost:2375"],
)
def test_a_loopback_tcp_endpoint_is_this_machine(tmp_path: Path, endpoint: str):
"""Docker Desktop can expose its daemon on tcp://localhost:2375, and a socket can be
diff --git a/tests/version_compat/test_bitsandbytes_pinned_symbols.py b/tests/version_compat/test_bitsandbytes_pinned_symbols.py
index a21ce157b38..f6a225b89ed 100644
--- a/tests/version_compat/test_bitsandbytes_pinned_symbols.py
+++ b/tests/version_compat/test_bitsandbytes_pinned_symbols.py
@@ -13,8 +13,6 @@ import pytest
from tests.version_compat._fetch import fetch_text, first_match, has_def
-
-
def _super_init_call(source: str, class_name: str) -> ast.Call | None:
"""The ``super().__init__(...)`` Call node inside ``class_name``'s __init__.
@@ -34,6 +32,7 @@ def _super_init_call(source: str, class_name: str) -> ast.Call | None:
return sub
return None
+
def first_match_signature(src: str, class_name: str) -> str | None:
"""The text of ``class_name``'s __init__ parameter list, or None."""
at = src.find(f"class {class_name}")
@@ -52,6 +51,7 @@ def first_match_signature(src: str, class_name: str) -> str | None:
return src[src.index("(", at) : i + 1]
return None
+
# pyproject pin: bitsandbytes>=0.45.5,!=0.46.0,!=0.48.0 Test floor + each safe minor since.
BNB_TAGS = [
"0.45.5",
@@ -306,6 +306,6 @@ def test_bnb_optimizer2state_options_are_not_passed_positionally(tag: str):
for name in ("percentile_clipping", "block_wise"):
if name in signature:
continue
- assert name not in passed, (
- f"{tag}: Optimizer2State no longer accepts {name}, but it is still passed."
- )
+ assert (
+ name not in passed
+ ), f"{tag}: Optimizer2State no longer accepts {name}, but it is still passed."