feat: add speculative decoding

This commit is contained in:
jialin
2025-11-03 10:14:30 +08:00
parent 608b2e31c7
commit 3613fb3f69
15 changed files with 356 additions and 165 deletions
+12
View File
@@ -42,6 +42,9 @@ export const FormContext = React.createContext<FormContextProps>(
{} as FormContextProps
);
/**
* Catalog form context
*/
export const CatalogFormContext = React.createContext<CatalogFormContextProps>(
{} as CatalogFormContextProps
);
@@ -50,6 +53,10 @@ export const FormOuterContext = React.createContext<FormOuterContextProps>(
{} as FormOuterContextProps
);
/**
* Hooks to use the form context
*/
export const useFormContext = () => {
const context = React.useContext(FormContext);
if (!context) {
@@ -68,6 +75,11 @@ export const useCatalogFormContext = () => {
return context;
};
/**
*
* Hooks to use the outer form context
*/
export const useFormOuterContext = () => {
const context = React.useContext(FormOuterContext);
if (!context) {
+22 -1
View File
@@ -82,6 +82,14 @@ export interface FormData {
ram_ratio: number;
ram_size: number;
};
speculative_config: {
enabled: boolean;
algorithm: string;
draft_model_name: string;
num_draft_tokens: number;
ngram_min_match_length: number;
ngram_max_match_length: number;
};
}
interface ComputedResourceClaim {
@@ -168,7 +176,8 @@ export interface CatalogItem {
icon: string;
categories: string[];
capabilities: string[];
sizes: number[];
size: number;
activated_size: number;
licenses: string[];
release_date: string;
}
@@ -279,3 +288,15 @@ export interface BackendItem {
is_deprecated: boolean;
}[];
}
export interface DraftModelItem {
source: string;
huggingface_repo_id: string;
huggingface_filename: string;
ollama_library_model_name: string;
model_scope_model_id: string;
model_scope_file_path: string;
local_path: string;
name: string;
algorithm: string;
}