Parameter Precision

This commit is contained in:
Roy Han 2024-06-20 10:38:31 -07:00
parent fedf71635e
commit af370ac178
3 changed files with 4 additions and 4 deletions

View File

@ -656,7 +656,7 @@ func ShowHandler(cmd *cobra.Command, args []string) error {
modelData := [][]string{
{"arch", arch},
{"parameters", resp.Details.ParameterSize},
{"parameters", format.HumanNumber(uint64(resp.ModelInfo["general.parameter_count"].(float64)))},
{"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))},

View File

@ -18,7 +18,7 @@ func HumanNumber(b uint64) string {
if number == math.Floor(number) {
return fmt.Sprintf("%.0fB", number) // no decimals if whole number
}
return fmt.Sprintf("%.1fB", number) // one decimal if not a whole number
return fmt.Sprintf("%.2fB", number) // two decimals if not a whole number
case b >= Million:
number := float64(b) / Million
if number == math.Floor(number) {

View File

@ -17,8 +17,8 @@ func TestHumanNumber(t *testing.T) {
{500500000, "500.50M"},
{500550000, "500.55M"},
{1000000000, "1B"},
{2800000000, "2.8B"},
{2850000000, "2.9B"},
{2800000000, "2.80B"},
{2850000000, "2.85B"},
{1000000000000, "1000B"},
}