File size: 4,017 Bytes
948b11c 96812c9 948b11c 96812c9 948b11c 2f35054 bd915ca 22f8eb7 bd915ca ad5cef3 948b11c ad5cef3 e7ba29d 96812c9 948b11c daa5539 b1c66bb 96812c9 2656c1e 948b11c 08476ef e7ba29d 96812c9 2656c1e 5b8fd7e daa5539 2f35054 ca67cfa 2656c1e 2f35054 96812c9 22f8eb7 31283f8 22f8eb7 25647ae 79eafc9 25647ae 79eafc9 25647ae 046ca57 ca67cfa 046ca57 22f8eb7 dc79f22 6ebf2fd dc79f22 f3b30b4 6ebf2fd dc79f22 6ebf2fd 96812c9 59a1fe9 96812c9 59a1fe9 6ebf2fd 97cab0c 79eafc9 f3b30b4 79eafc9 59a1fe9 2f35054 59a1fe9 6ebf2fd 59a1fe9 6ebf2fd 59a1fe9 6ebf2fd f3b30b4 6ebf2fd 59a1fe9 97cab0c 79eafc9 96812c9 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 |
export interface Section {
title: string
items: string[]
}
export interface ClassificationOutput {
sequence: string
labels: string[]
scores: number[]
}
export interface ChatMessage {
role: 'system' | 'user' | 'assistant'
content: string
}
export interface GenerationOutput {
role: 'assistant'
content: string
}
export type WorkerStatus =
| 'initiate'
| 'ready'
| 'output'
| 'loading'
| 'progress'
| 'error'
| 'disposed'
export interface WorkerMessage {
status: WorkerStatus
progress?: number
error?: string
output?: any
}
export interface ZeroShotWorkerInput {
type: 'classify'
text: string
labels: string[]
model: string
dtype: QuantizationType
}
export interface TextClassificationWorkerInput {
type: 'classify'
text: string
model: string
dtype: QuantizationType
config?: {
top_k?: number
}
}
export interface TextGenerationWorkerInput {
type: 'generate'
prompt?: string
messages?: ChatMessage[]
hasChatTemplate: boolean
model: string
config?: {
temperature?: number
max_new_tokens?: number
top_p?: number
top_k?: number
do_sample?: boolean
}
dtype: QuantizationType
}
export interface FeatureExtractionWorkerInput {
type: 'extract' | 'load'
texts?: string[]
model: string
dtype: QuantizationType
config: {
pooling: 'mean' | 'cls'
normalize: boolean
}
}
export interface TextToSpeechWorkerInput {
type: 'synthesize'
text: string
model: string
dtype: QuantizationType
isStyleTTS2: boolean
config?: {
speakerEmbeddings?: string
voice?: string
}
}
export interface ImageClassificationWorkerInput {
type: 'classify'
image: string | ImageData | HTMLImageElement | HTMLCanvasElement
model: string
dtype: QuantizationType
config: {
top_k?: number
}
}
export interface ImageClassificationResult {
label: string
score: number
}
export interface ImageExample {
id: string
name: string
url: string
file?: File
predictions?: ImageClassificationResult[]
isLoading?: boolean
}
export interface EmbeddingExample {
id: string
text: string
embedding?: number[]
isLoading?: boolean
}
export interface SimilarityResult {
exampleId: string
similarity: number
}
const q8Types = ['q8', 'int8', 'bnb8', 'uint8'] as const
const q4Types = ['q4', 'bnb4', 'q4f16'] as const
const fp16Types = ['fp16'] as const
const fp32Types = ['fp32'] as const
type q8 = (typeof q8Types)[number]
type q4 = (typeof q4Types)[number]
type fp16 = (typeof fp16Types)[number]
type fp32 = (typeof fp32Types)[number]
export type QuantizationType = q8 | q4 | fp16 | fp32
export const allQuantizationTypes = [
...q8Types,
...q4Types,
...fp16Types,
...fp32Types
] as const
export interface ModelInfo {
id: string
name: string
architecture: string
parameters: number
likes: number
downloads: number
createdAt: string
isCompatible?: boolean
incompatibilityReason?: string
supportedQuantizations: QuantizationType[]
baseId?: string
readme?: string
hasChatTemplate: boolean // text-generation only
isStyleTTS2: boolean // text-to-speech only
widgetData?: any
voices: string[] // text-to-speech only
}
export interface ModelInfoResponse {
id: string
createdAt: string
config?: {
architectures: string[]
model_type: string
tokenizer_config?: {
chat_template?: string
}
}
lastModified: string
pipeline_tag: string
tags: string[]
cardData?: {
base_model: string
}
baseId?: string
transformersInfo: {
pipeline_tag: string
auto_model: string
processor: string
}
safetensors?: {
parameters: {
BF16?: number
F16?: number
F32?: number
total?: number
}
}
siblings?: {
rfilename: string
}[]
widgetData?: any
modelId?: string
isCompatible: boolean
incompatibilityReason?: string
supportedQuantizations: QuantizationType[]
likes: number
downloads: number
readme?: string
voices: string[] // text-to-speech only
}
|