mirror of https://gitee.com/namelin2022/ollama
Browse Source
* parse tensor info * refactor decoder * return actual parameter count * explicit rounding * s/Human/HumanNumber/editor
committed by
GitHub
2 changed files with 72 additions and 18 deletions
@ -0,0 +1,25 @@ |
|||
package format |
|||
|
|||
import ( |
|||
"fmt" |
|||
"math" |
|||
) |
|||
|
|||
const ( |
|||
Thousand = 1000 |
|||
Million = Thousand * 1000 |
|||
Billion = Million * 1000 |
|||
) |
|||
|
|||
func HumanNumber(b uint64) string { |
|||
switch { |
|||
case b > Billion: |
|||
return fmt.Sprintf("%.0fB", math.Round(float64(b)/Billion)) |
|||
case b > Million: |
|||
return fmt.Sprintf("%.0fM", math.Round(float64(b)/Million)) |
|||
case b > Thousand: |
|||
return fmt.Sprintf("%.0fK", math.Round(float64(b)/Thousand)) |
|||
default: |
|||
return fmt.Sprintf("%d", b) |
|||
} |
|||
} |
|||
Loading…
Reference in new issue