File size: 3,182 Bytes
bce29b9 |
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 |
import type { PipelineType } from "./pipelines.js";
import type { WidgetExample } from "./widget-example.js";
import type { TokenizerConfig } from "./tokenizer-data.js";
/**
* Public interface for model metadata
*/
export interface ModelData {
/**
* id of model (e.g. 'user/repo_name')
*/
id: string;
/**
* Whether or not to enable inference widget for this model
* TODO(type it)
*/
inference: string;
/**
* is this model private?
*/
private?: boolean;
/**
* this dictionary has useful information about the model configuration
*/
config?: {
architectures?: string[];
/**
* Dict of AutoModel or Auto… class name to local import path in the repo
*/
auto_map?: {
/**
* String Property
*/
[x: string]: string;
};
model_type?: string;
quantization_config?: {
bits?: number;
load_in_4bit?: boolean;
load_in_8bit?: boolean;
/**
* awq, gptq, aqlm, marlin, … Used by vLLM
*/
quant_method?: string;
};
tokenizer_config?: TokenizerConfig;
adapter_transformers?: {
model_name?: string;
model_class?: string;
};
diffusers?: {
_class_name?: string;
};
sklearn?: {
model?: {
file?: string;
};
model_format?: string;
};
speechbrain?: {
speechbrain_interface?: string;
vocoder_interface?: string;
vocoder_model_id?: string;
};
peft?: {
base_model_name_or_path?: string;
task_type?: string;
};
keras_hub?: {
tasks?: string[];
};
};
/**
* all the model tags
*/
tags: string[];
/**
* transformers-specific info to display in the code sample.
*/
transformersInfo?: TransformersInfo;
/**
* Pipeline type
*/
pipeline_tag?: PipelineType | undefined;
/**
* for relevant models, get mask token
*/
mask_token?: string | undefined;
/**
* Example data that will be fed into the widget.
*
* can be set in the model card metadata (under `widget`),
* or by default in `DefaultWidget.ts`
*/
widgetData?: WidgetExample[] | undefined;
/**
* Parameters that will be used by the widget when calling Inference API (serverless)
* https://huggingface.co/docs/api-inference/detailed_parameters
*
* can be set in the model card metadata (under `inference/parameters`)
* Example:
* inference:
* parameters:
* key: val
*/
cardData?: {
inference?:
| boolean
| {
parameters?: Record<string, unknown>;
};
base_model?: string | string[];
instance_prompt?: string | null;
};
/**
* Library name
* Example: transformers, SpeechBrain, Stanza, etc.
*/
library_name?: string;
safetensors?: {
parameters: Record<string, number>;
total: number;
sharded: boolean;
};
gguf?: {
total: number;
architecture?: string;
context_length?: number;
};
}
/**
* transformers-specific info to display in the code sample.
*/
export interface TransformersInfo {
/**
* e.g. AutoModelForSequenceClassification
*/
auto_model: string;
/**
* if set in config.json's auto_map
*/
custom_class?: string;
/**
* e.g. text-classification
*/
pipeline_tag?: PipelineType;
/**
* e.g. "AutoTokenizer" | "AutoFeatureExtractor" | "AutoProcessor"
*/
processor?: string;
}
|