machineuser commited on
Commit
5f7c180
1 Parent(s): 3688663

Sync widgets demo

Browse files
packages/tasks/src/model-data.ts CHANGED
@@ -40,21 +40,46 @@ export interface ModelData {
40
  /**
41
  * this dictionary has useful information about the model configuration
42
  */
43
- config?: Record<string, unknown> & {
44
- adapter_transformers?: { model_class?: string; model_name?: string };
45
  architectures?: string[];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  sklearn?: {
47
- filename?: string;
 
 
48
  model_format?: string;
49
  };
50
  speechbrain?: {
51
- interface?: string;
 
 
52
  };
53
  peft?: {
54
- base_model_name?: string;
55
  task_type?: string;
56
  };
57
- tokenizer_config?: TokenizerConfig;
58
  };
59
  /**
60
  * all the model tags
 
40
  /**
41
  * this dictionary has useful information about the model configuration
42
  */
43
+ config?: {
 
44
  architectures?: string[];
45
+ /**
46
+ * Dict of AutoModel or Auto… class name to local import path in the repo
47
+ */
48
+ auto_map?: {
49
+ /**
50
+ * String Property
51
+ */
52
+ [x: string]: string;
53
+ };
54
+ model_type?: string;
55
+ quantization_config?: {
56
+ bits?: number;
57
+ load_in_4bit?: boolean;
58
+ load_in_8bit?: boolean;
59
+ };
60
+ tokenizer_config?: TokenizerConfig;
61
+ adapter_transformers?: {
62
+ model_name?: string;
63
+ model_class?: string;
64
+ };
65
+ diffusers?: {
66
+ _class_name?: string;
67
+ };
68
  sklearn?: {
69
+ model?: {
70
+ file?: string;
71
+ };
72
  model_format?: string;
73
  };
74
  speechbrain?: {
75
+ speechbrain_interface?: string;
76
+ vocoder_interface?: string;
77
+ vocoder_model_id?: string;
78
  };
79
  peft?: {
80
+ base_model_name_or_path?: string;
81
  task_type?: string;
82
  };
 
83
  };
84
  /**
85
  * all the model tags
packages/tasks/src/model-libraries-snippets.ts CHANGED
@@ -293,7 +293,7 @@ model = joblib.load(
293
 
294
  export const sklearn = (model: ModelData): string[] => {
295
  if (model.tags?.includes("skops")) {
296
- const skopsmodelFile = model.config?.sklearn?.filename;
297
  const skopssaveFormat = model.config?.sklearn?.model_format;
298
  if (!skopsmodelFile) {
299
  return [`# ⚠️ Model filename not specified in config.json`];
@@ -372,7 +372,7 @@ const speechBrainMethod = (speechbrainInterface: string) => {
372
  };
373
 
374
  export const speechbrain = (model: ModelData): string[] => {
375
- const speechbrainInterface = model.config?.speechbrain?.interface;
376
  if (speechbrainInterface === undefined) {
377
  return [`# interface not specified in config.json`];
378
  }
@@ -465,7 +465,7 @@ const peftTask = (peftTaskType?: string) => {
465
  };
466
 
467
  export const peft = (model: ModelData): string[] => {
468
- const { base_model_name: peftBaseModel, task_type: peftTaskType } = model.config?.peft ?? {};
469
  const pefttask = peftTask(peftTaskType);
470
  if (!pefttask) {
471
  return [`Task type is invalid.`];
 
293
 
294
  export const sklearn = (model: ModelData): string[] => {
295
  if (model.tags?.includes("skops")) {
296
+ const skopsmodelFile = model.config?.sklearn?.model?.file;
297
  const skopssaveFormat = model.config?.sklearn?.model_format;
298
  if (!skopsmodelFile) {
299
  return [`# ⚠️ Model filename not specified in config.json`];
 
372
  };
373
 
374
  export const speechbrain = (model: ModelData): string[] => {
375
+ const speechbrainInterface = model.config?.speechbrain?.speechbrain_interface;
376
  if (speechbrainInterface === undefined) {
377
  return [`# interface not specified in config.json`];
378
  }
 
465
  };
466
 
467
  export const peft = (model: ModelData): string[] => {
468
+ const { base_model_name_or_path: peftBaseModel, task_type: peftTaskType } = model.config?.peft ?? {};
469
  const pefttask = peftTask(peftTaskType);
470
  if (!pefttask) {
471
  return [`Task type is invalid.`];