fix(cmd): show info may have nil ModelInfo (#6579)

This commit is contained in:
Vimal Kumar 2024-09-01 09:42:17 +05:30 committed by GitHub
parent 1aad838707
commit 5f7b4a5e30
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -726,14 +726,17 @@ func ShowHandler(cmd *cobra.Command, args []string) error {
} }
func showInfo(resp *api.ShowResponse) { func showInfo(resp *api.ShowResponse) {
arch := resp.ModelInfo["general.architecture"].(string)
modelData := [][]string{ modelData := [][]string{
{"arch", arch},
{"parameters", resp.Details.ParameterSize}, {"parameters", resp.Details.ParameterSize},
{"quantization", resp.Details.QuantizationLevel}, {"quantization", resp.Details.QuantizationLevel},
{"context length", fmt.Sprintf("%v", resp.ModelInfo[fmt.Sprintf("%s.context_length", arch)].(float64))}, }
{"embedding length", fmt.Sprintf("%v", resp.ModelInfo[fmt.Sprintf("%s.embedding_length", arch)].(float64))}, if resp.ModelInfo != nil {
arch := resp.ModelInfo["general.architecture"].(string)
modelData = append(modelData,
[]string{"arch", arch},
[]string{"context length", fmt.Sprintf("%v", resp.ModelInfo[fmt.Sprintf("%s.context_length", arch)].(float64))},
[]string{"embedding length", fmt.Sprintf("%v", resp.ModelInfo[fmt.Sprintf("%s.embedding_length", arch)].(float64))},
)
} }
mainTableData := [][]string{ mainTableData := [][]string{