-
Notifications
You must be signed in to change notification settings - Fork 2
/
Type.go
74 lines (56 loc) · 967 Bytes
/
Type.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package gguf
import (
"fmt"
)
// Type is the type of a GGUF metadata value.
type Type uint32
const (
Uint8 Type = 0
Int8 Type = 1
Uint16 Type = 2
Int16 Type = 3
Uint32 Type = 4
Int32 Type = 5
Float32 Type = 6
Bool Type = 7
String Type = 8
Array Type = 9
// Added in v2
Uint64 Type = 10
Int64 Type = 11
Float64 Type = 12
)
// String returns the string representation of a GGUF type.
// Implements fmt.Stringer.
func (t Type) String() string {
switch t {
case Uint8:
return "uint8"
case Int8:
return "int8"
case Uint16:
return "uint16"
case Int16:
return "int16"
case Uint32:
return "uint32"
case Int32:
return "int32"
case Float32:
return "float32"
case Bool:
return "bool"
case String:
return "string"
case Array:
return "array"
case Uint64:
return "uint64"
case Int64:
return "int64"
case Float64:
return "float64"
default:
return fmt.Sprintf("unknown-type-%d", t)
}
}