mirror of
https://github.com/dogkeeper886/ollama37.git
synced 2025-12-10 07:46:59 +00:00
quantize any fp16/fp32 model
- FROM /path/to/{safetensors,pytorch}
- FROM /path/to/fp{16,32}.bin
- FROM model:fp{16,32}
This commit is contained in:
32
types/ordered/map.go
Normal file
32
types/ordered/map.go
Normal file
@@ -0,0 +1,32 @@
|
||||
package ordered
|
||||
|
||||
type Map[K comparable, V any] struct {
|
||||
s []K
|
||||
m map[K]V
|
||||
}
|
||||
|
||||
func NewMap[K comparable, V any]() *Map[K, V] {
|
||||
return &Map[K, V]{
|
||||
s: make([]K, 0),
|
||||
m: make(map[K]V),
|
||||
}
|
||||
}
|
||||
|
||||
type iter_Seq2[K, V any] func(func(K, V) bool)
|
||||
|
||||
func (m *Map[K, V]) Items() iter_Seq2[K, V] {
|
||||
return func(yield func(K, V) bool) {
|
||||
for _, k := range m.s {
|
||||
if !yield(k, m.m[k]) {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (m *Map[K, V]) Add(k K, v V) {
|
||||
if _, ok := m.m[k]; !ok {
|
||||
m.s = append(m.s, k)
|
||||
m.m[k] = v
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user