Skip to content

Commit

Permalink
feat(model): add model run count (#431)
Browse files Browse the repository at this point in the history
Because

- On the Explore page, all models are publicly available. Displaying the
"Run" count will help new users who are unsure of what they need to
start with the most popular models. One of the indicators for popularity
is the number of times a model has been run.
- For users managing their own resources, it allows a quick
understanding of the popularity of their models, whether public or
private.

This commit

- add model run count in model message

---------

Co-authored-by: droplet-bot <[email protected]>
  • Loading branch information
heiruwu and droplet-bot authored Aug 20, 2024
1 parent eeebd1e commit 9f6fe76
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
10 changes: 10 additions & 0 deletions model/model/v1alpha/model.proto
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,14 @@ message Model {
VISIBILITY_PUBLIC = 2;
}

// Statistic data
message Stats {
// Number of model runs.
int32 number_of_runs = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
// Last run time.
google.protobuf.Timestamp last_run_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
}

// The resource name of the model, which allows its access by owner and ID.
// - Format: `users/{user.id}/models/{model.id}`.
string name = 1 [
Expand Down Expand Up @@ -222,6 +230,8 @@ message Model {
repeated string tags = 30 [(google.api.field_behavior) = OUTPUT_ONLY];
// Version names.
repeated string versions = 31 [(google.api.field_behavior) = OUTPUT_ONLY];
// Statistic data.
Stats stats = 32 [(google.api.field_behavior) = OUTPUT_ONLY];
}

// ListModelsRequest represents a request to list models.
Expand Down
29 changes: 29 additions & 0 deletions openapiv2/model/service.swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1248,6 +1248,11 @@ paths:
type: string
description: Version names.
readOnly: true
stats:
description: Statistic data.
readOnly: true
allOf:
- $ref: '#/definitions/ModelStats'
title: The model to update
required:
- id
Expand Down Expand Up @@ -1986,6 +1991,11 @@ paths:
type: string
description: Version names.
readOnly: true
stats:
description: Statistic data.
readOnly: true
allOf:
- $ref: '#/definitions/ModelStats'
title: The model to update
required:
- id
Expand Down Expand Up @@ -2734,6 +2744,20 @@ definitions:
description: TriggerUserModelRequest represents a request to trigger a model inference.
required:
- taskInputs
ModelStats:
type: object
properties:
numberOfRuns:
type: integer
format: int32
description: Number of model runs.
readOnly: true
lastRunTime:
type: string
format: date-time
description: Last run time.
readOnly: true
title: Statistic data
googlelongrunningOperation:
type: object
properties:
Expand Down Expand Up @@ -3817,6 +3841,11 @@ definitions:
type: string
description: Version names.
readOnly: true
stats:
description: Statistic data.
readOnly: true
allOf:
- $ref: '#/definitions/ModelStats'
title: |-
Model represents an AI model, i.e. a program that performs tasks as decision
making or or pattern recognition based on its training data
Expand Down

0 comments on commit 9f6fe76

Please sign in to comment.