File tree Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -218,13 +218,26 @@ const timm = (model: ModelData) =>
218218
219219model = timm.create_model("hf_hub:${ model . id } ", pretrained=True)` ;
220220
221- const sklearn = ( model : ModelData ) =>
222- `from huggingface_hub import hf_hub_download
221+ const sklearn = ( model : ModelData ) => {
222+ if ( model . tags ?. includes ( "skops" ) ) {
223+ const skopsmodelFile = model . config ?. sklearn ?. filename ;
224+ return `from skops.hub_utils import download
225+ from skops.io import load
226+
227+ download("${ model . id } ", "path_to_folder")
228+ # make sure model file is in skops format
229+ # if model is a pickle file, make sure it's from a source you trust
230+ model = load("path_to_folder/${ skopsmodelFile } ")` ;
231+ } else {
232+ return `from huggingface_hub import hf_hub_download
223233import joblib
224234
225235model = joblib.load(
226236 hf_hub_download("${ model . id } ", "sklearn_model.joblib")
227- )` ;
237+ )` ;
238+ }
239+ } ;
240+
228241
229242const fastai = ( model : ModelData ) =>
230243 `from huggingface_hub import from_pretrained_fastai
You can’t perform that action at this time.
0 commit comments