Merge 444a67cffa54436164ac44a110db9ebc9a2603be into 50b5962042d7c5026d5507af44ae28294f8568d9

This commit is contained in:
Charles Holtzkampf 2025-03-17 17:31:09 +00:00 committed by GitHub
commit 20ebed3dbe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 19 additions and 3 deletions

View File

@ -421,6 +421,7 @@ type ProcessModelResponse struct {
Details ModelDetails `json:"details,omitempty"`
ExpiresAt time.Time `json:"expires_at"`
SizeVRAM int64 `json:"size_vram"`
Active bool `json:"active"`
}
type RetrieveModelResponse struct {

View File

@ -513,12 +513,20 @@ func ListRunningHandler(cmd *cobra.Command, args []string) error {
} else {
until = format.HumanTime(m.ExpiresAt, "Never")
}
data = append(data, []string{m.Name, m.Digest[:12], format.HumanBytes(m.Size), procStr, until})
var activeStr string
if m.Active {
activeStr = "Yes"
} else {
activeStr = "No"
}
data = append(data, []string{m.Name, m.Digest[:12], format.HumanBytes(m.Size), procStr, activeStr, until})
}
}
table := tablewriter.NewWriter(os.Stdout)
table.SetHeader([]string{"NAME", "ID", "SIZE", "PROCESSOR", "UNTIL"})
table.SetHeader([]string{"NAME", "ID", "SIZE", "PROCESSOR", "ACTIVE", "UNTIL"})
table.SetHeaderAlignment(tablewriter.ALIGN_LEFT)
table.SetAlignment(tablewriter.ALIGN_LEFT)
table.SetHeaderLine(false)

View File

@ -1553,7 +1553,8 @@ A single JSON object will be returned.
"quantization_level": "Q4_0"
},
"expires_at": "2024-06-04T14:38:31.83753-07:00",
"size_vram": 5137025024
"size_vram": 5137025024,
"active": true
}
]
}

View File

@ -1402,6 +1402,11 @@ func (s *Server) PsHandler(c *gin.Context) {
QuantizationLevel: model.Config.FileType,
}
// Lock the reference mutex to safely check the reference count
v.refMu.Lock()
isActive := v.refCount > 0
v.refMu.Unlock()
mr := api.ProcessModelResponse{
Model: model.ShortName,
Name: model.ShortName,
@ -1410,6 +1415,7 @@ func (s *Server) PsHandler(c *gin.Context) {
Digest: model.Digest,
Details: modelDetails,
ExpiresAt: v.expiresAt,
Active: isActive,
}
// The scheduler waits to set expiresAt, so if a model is loading it's
// possible that it will be set to the unix epoch. For those cases, just