Initial Draft of Information
Co-Authored-By: Patrick Devine <pdevine@sonic.net>
This commit is contained in:
parent
ccd624ca44
commit
30f7064363
16
api/types.go
16
api/types.go
@ -232,14 +232,14 @@ type ShowRequest struct {
|
|||||||
|
|
||||||
// ShowResponse is the response returned from [Client.Show].
|
// ShowResponse is the response returned from [Client.Show].
|
||||||
type ShowResponse struct {
|
type ShowResponse struct {
|
||||||
License string `json:"license,omitempty"`
|
License string `json:"license,omitempty"`
|
||||||
Modelfile string `json:"modelfile,omitempty"`
|
Modelfile string `json:"modelfile,omitempty"`
|
||||||
Parameters string `json:"parameters,omitempty"`
|
Parameters string `json:"parameters,omitempty"`
|
||||||
Template string `json:"template,omitempty"`
|
Template string `json:"template,omitempty"`
|
||||||
System string `json:"system,omitempty"`
|
System string `json:"system,omitempty"`
|
||||||
Details ModelDetails `json:"details,omitempty"`
|
Details ModelDetails `json:"details,omitempty"`
|
||||||
Messages []Message `json:"messages,omitempty"`
|
Messages []Message `json:"messages,omitempty"`
|
||||||
ModelInfo string `json:"model_info,omitempty"`
|
ModelInfo json.RawMessage `json:"model_info,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// CopyRequest is the request passed to [Client.Copy].
|
// CopyRequest is the request passed to [Client.Copy].
|
||||||
|
@ -724,7 +724,7 @@ func GetModelInfo(req api.ShowRequest) (*api.ShowResponse, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
resp.ModelInfo = string(ggmlData)
|
resp.ModelInfo = ggmlData
|
||||||
|
|
||||||
return resp, nil
|
return resp, nil
|
||||||
}
|
}
|
||||||
@ -740,32 +740,27 @@ func getGGMLData(model *Model) ([]byte, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
kv := ggml.KV()
|
f.Close()
|
||||||
var keys []string
|
|
||||||
for k := range kv {
|
|
||||||
keys = append(keys, k)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
kv := ggml.KV()
|
||||||
kvMap := make(map[string]any)
|
kvMap := make(map[string]any)
|
||||||
|
|
||||||
for _, k := range keys {
|
for k := range kv {
|
||||||
val := kv[k]
|
val := kv[k]
|
||||||
|
|
||||||
switch v := val.(type) {
|
switch v := val.(type) {
|
||||||
case []interface{}:
|
case []interface{}:
|
||||||
if len(v) > 5 {
|
if len(v) > 5 {
|
||||||
kvMap[k] = []string{}
|
kvMap[k] = []string{}
|
||||||
continue
|
|
||||||
}
|
}
|
||||||
|
default:
|
||||||
|
kvMap[k] = val
|
||||||
}
|
}
|
||||||
kvMap[k] = val
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ggmlMap := make(map[string]any)
|
kvMap["embedding_model"] = model.IsEmbedding()
|
||||||
ggmlMap["kv"] = kvMap
|
|
||||||
ggmlMap["tensors"] = ggml.Tensors()
|
|
||||||
|
|
||||||
ggmlJson, err := json.Marshal(ggmlMap)
|
ggmlJson, err := json.Marshal(kvMap)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user