Skip to main content

Manage models

tip

Recommended tutorials for setting up the local version

1. Add a model

Download a Hugging Face model and save on your disk. In this tutorial, bert-large-uncased-whole-word-masking-finetuned-squad model will be downloaded from the Hugging Face Hub. It is a model finetuned on the SQuAD dataset. If the model is saved in ./bert-squad directory, we can upload it to our registry using the following command:

stochasticx models upload \
--name "bert-squad" \
--dir_path "./bert-squad" \
--type "hf"
info
  • name: will allow you to identify the model later.
  • dir_path: directory path where your model is located.
  • type: model type. In this case a Hugging Face model

2. List and inspect your models

You can list your models with the following command:

stochasticx models ls
CLI output
[+] Collecting all local models

┏━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━┳━━━━━━━━━━┓
┃ Id ┃ Name ┃ Directory path ┃ Type ┃ Uploaded ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━╇━━━━━━━━━━┩
│ 62e3a5aab5beb3002644093e │ bert-squad │ │ hf │ True │
└──────────────────────────┴─────────────────────────┴────────────────┴──────┴──────────┘

To inspect this model further:

stochasticx models inspect --id "62e3a5aab5beb3002644093e"
CLI output
Model ID: 62e3a5aab5beb3002644093e ; Name: bert-squad ; Directory path: None ; Model type: hf ; Uploaded: True


{
"model_type":"bert",
"id2label":"None",
"label2id":"None",
"max_position_embeddings":512,
"torch_dtype":"float32",
"vocab_size":30522,
"hugging_face_tasks":[
"BertForQuestionAnswering"
],
"model_size":1336507185,
"specific_model_info":{
"_name_or_path":"bert-large-uncased-whole-word-masking-finetuned-squad",
"attention_probs_dropout_prob":0.1,
"classifier_dropout":"None",
"hidden_act":"gelu",
"hidden_dropout_prob":0.1,
"hidden_size":1024,
"initializer_range":0.02,
"intermediate_size":4096,
"layer_norm_eps":1e-12,
"num_attention_heads":16,
"num_hidden_layers":24,
"pad_token_id":0,
"position_embedding_type":"absolute",
"transformers_version":"4.18.0",
"type_vocab_size":2,
"use_cache":true
}
}

3. Remove a model

stochasticx models remove \
--model_id "62e3a5aab5beb3002644093e"
info
  • model_id: id of the model to remove.