File size: 6,438 Bytes
21dd449 |
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 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 |
import type { ModelLibraryKey, TransformersInfo, WidgetType } from "@huggingface/tasks";
import type { License, PipelineType } from "../public";
export interface ApiModelInfo {
_id: string;
id: string;
arxivIds: string[];
author?: string;
cardData?: ApiModelMetadata;
cardError: unknown;
cardExists?: true;
config: unknown;
contributors: Array<{ user: string; _id: string }>;
disabled: boolean;
discussionsDisabled: boolean;
doi?: { id: string; commit: string };
downloads: number;
downloadsAllTime: number;
files: string[];
gitalyUid: string;
inferenceProviderMapping: Partial<
Record<string, { providerId: string; status: "live" | "staging"; task: WidgetType }>
>;
lastAuthor: { email: string; user?: string };
lastModified: string; // convert to date
library_name?: ModelLibraryKey;
likes: number;
likesRecent: number;
private: boolean;
gated: false | "auto" | "manual";
sha: string;
spaces: string[];
updatedAt: string; // convert to date
createdAt: string; // convert to date
pipeline_tag: PipelineType;
tags: string[];
"model-index": unknown;
safetensors?: {
parameters: Record<string, number>;
total: number;
};
transformersInfo?: TransformersInfo;
}
export interface ApiModelIndex {
name: string;
results: {
task: {
/**
* Example: automatic-speech-recognition
Use task id from https://github.com/huggingface/huggingface.js/blob/main/packages/tasks/src/tasksData.ts
*/
type: string;
/**
* Example: Speech Recognition
*/
name?: string;
};
/**
* This will switch to required at some point.
in any case, we need them to link to PWC
*/
dataset?: {
/**
* Example: common_voice. Use dataset id from https://hf.co/datasets
*/
type: string;
/**
* A pretty name for the dataset. Example: Common Voice zh-CN
Also encode config params into the name if relevant.
*/
name: string;
/**
* Optional. The name of the dataset configuration used in `load_dataset()`
*/
config?: string;
/**
* Optional. Example: test
*/
split?: string;
/**
* Optional. Example: 5503434ddd753f426f4b38109466949a1217c2bb
*/
revision?: string;
args?:
| string
| {
/**
* String Property
*/
[x: string]: string;
};
};
metrics: {
/**
* Example: wer. Use metric id from https://hf.co/metrics
*/
type: string;
/**
* Required. Example: 20.0 or "20.0 ± 1.2"
*/
value: unknown;
/**
* Example: Test WER
*/
name?: string;
/**
* Optional. The name of the metric configuration used in `load_metric()`.
*/
config?: string;
args?:
| string
| {
/**
* String Property
*/
[x: string]: string;
};
/**
* [Automatically computed, do not set] Dynamically overridden by huggingface in API calls to indicate if it was verified by Hugging Face.
*/
verified?: boolean;
/**
* Generated by Hugging Face to prove the results are valid. <add doc link>
*/
verifyToken?: string;
}[];
/**
* The source for this evaluation result.
*/
source?: {
/**
* Example: Open LLM Leaderboard
*/
name?: string;
/**
* Example: https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard
*/
url: string;
};
}[];
}
export interface ApiWidgetExampleFromModelcard {
example_title?: string;
group?: string;
text?: string;
src?: string;
table?: {
/**
* (string | number)[] Property
*/
[x: string]: (string | number)[];
};
structured_data?: {
/**
* (string | number)[] Property
*/
[x: string]: (string | number)[];
};
candidate_labels?: string;
messages?: {
role: "system" | "user" | "assistant";
content: string;
}[];
multi_class?: boolean;
source_sentence?: string;
sentences?: string[];
parameters?: {
aggregation_strategy?: string;
top_k?: number;
top_p?: number;
temperature?: number;
max_new_tokens?: number;
do_sample?: boolean;
negative_prompt?: string;
guidance_scale?: number;
num_inference_steps?: number;
};
output?:
| {
label: string;
score: number;
}[]
| {
answer: string;
score: number;
}
| {
text: string;
}
| {
url: string;
};
}
export interface ApiModelMetadata {
datasets?: string | string[];
license?: License | License[];
license_name?: string;
license_link?: "LICENSE" | "LICENSE.md" | string;
license_details?: string;
inference?:
| boolean
| {
parameters?: {
aggregation_strategy?: string;
top_k?: number;
top_p?: number;
temperature?: number;
max_new_tokens?: number;
do_sample?: boolean;
negative_prompt?: string;
guidance_scale?: number;
num_inference_steps?: number;
};
};
language?: string | string[];
language_bcp47?: string[];
language_details?: string;
tags?: string[];
pipeline_tag?: string;
co2_eq_emissions?:
| number
| {
/**
* Emissions in grams of CO2
*/
emissions: number;
/**
* source of the information, either directly from AutoTrain, code carbon or from a scientific article documenting the model
*/
source?: string;
/**
* pre-training or fine-tuning
*/
training_type?: string;
/**
* as granular as possible, for instance Quebec, Canada or Brooklyn, NY, USA
*/
geographical_location?: string;
/**
* how much compute and what kind, e.g. 8 v100 GPUs
*/
hardware_used?: string;
};
library_name?: string;
thumbnail?: string | null;
description?: string | null;
mask_token?: string;
widget?: ApiWidgetExampleFromModelcard[];
"model-index"?: ApiModelIndex[];
finetuned_from?: string;
base_model?: string | string[];
instance_prompt?: string | null;
extra_gated_prompt?: string;
extra_gated_fields?: {
/**
* "text" | "checkbox" | "date_picker" | "country" | "ip_location" | { type: "text" | "checkbox" | "date_picker" | "country" | "ip_location" } | { type: "select", options: Array<string | { label: string; value: string; }> } Property
*/
[x: string]:
| "text"
| "checkbox"
| "date_picker"
| "country"
| "ip_location"
| { type: "text" | "checkbox" | "date_picker" | "country" | "ip_location" }
| { type: "select"; options: Array<string | { label: string; value: string }> };
};
extra_gated_heading?: string;
extra_gated_description?: string;
extra_gated_button_content?: string;
}
|