Skip to content

Model Management#

This section covers the steps to monitor the status of your models on the FocoosAI platform.

Open In Colab

How to list the Focoos Models#

To list all the models available on the FocoosAI platform, you can use the following code:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
from focoos import Focoos

focoos = Focoos(api_key="<YOUR-API-KEY>")

models = focoos.list_focoos_models()
for model in models:
    print(f"Name: {model.name}")
    print(f"Reference: {model.ref}")
    print(f"Status: {model.status}")
    print(f"Task: {model.task}")
    print(f"Description: {model.description}")
    print("-" * 50)
models is a list of ModelPreview objects that contains the following information:

  • name: The name of the model.
  • ref: The reference of the model.
  • status: The status of the model.
  • task: The task of the model.
  • description: The description of the model.
  • status: The status of the model, which indicates its current state (e.g. CREATED, TRAINING_RUNNING, TRAINING_COMPLETED - see ModelStatus).

How to list all your models#

To list all your models, the library provides a list_models function. This function will return a list of Model objects.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
from focoos import Focoos

focoos = Focoos(api_key="<YOUR-API-KEY>")

models = focoos.list_models()
for model in models:
    print(f"Name: {model.name}")
    print(f"Reference: {model.ref}")
    print(f"Status: {model.status}")
    print(f"Task: {model.task}")
    print(f"Description: {model.description}")
    print(f"Focoos Model: {model.focoos_model}")
    print("-" * 50)
models is a list of ModelPreview objects that contains the following information:

  • name: The name of the model.
  • ref: The reference of the model.
  • status: The status of the model.
  • task: The task of the model.
  • description: The description of the model.
  • focoos_model: The starting Focoos Model used for training.
  • status: The status of the model, which indicates its current state (e.g. CREATED, TRAINING_RUNNING, TRAINING_COMPLETED - see ModelStatus).

See the metrics for a model#

To see the validation metrics of a model, you can use the metrics method on the model object.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
from focoos import Focoos

focoos = Focoos(api_key="<YOUR-API-KEY>")

model = focoos.get_remote_model("my-model")
metrics = model.metrics()

if metrics.best_valid_metric:
    print(f"Best validation metrics:")
    for k, v in metrics.best_valid_metric.items():
        print(f"  {k}: {v}")

if metrics.valid_metrics:
    print(f"Last iteration validation metrics:")
    for k, v in metrics.valid_metrics[-1].items():
        print(f"  {k}: {v}")

if metrics.train_metrics:
    print(f"Last iteration training metrics:")
    for k, v in metrics.train_metrics[-1].items():
        print(f"  {k}: {v}")
metrics is a Metrics object that contains the validation metrics of the model.

Delete a model#

To delete a model, you can use the delete_model method on the model object.

Warning

This action is irreversible and the model will be deleted forever from the platform.

1
2
3
4
5
6
from focoos import Focoos

focoos = Focoos(api_key="<YOUR-API-KEY>")

model = focoos.get_remote_model("my-model")
model.delete_model()