chore: use slices.Sorted(maps.Keys()) for ordered iteration
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
85775dc082
commit
eeec1fe372
1 changed files with 2 additions and 6 deletions
|
|
@ -12,6 +12,7 @@ import (
|
|||
"encoding/json"
|
||||
"fmt"
|
||||
"log/slog"
|
||||
"maps"
|
||||
"math"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
|
@ -152,12 +153,7 @@ func (a *LoRAAdapter) TotalParams() int {
|
|||
|
||||
// SortedNames returns layer names in deterministic sorted order.
|
||||
func (a *LoRAAdapter) SortedNames() []string {
|
||||
names := make([]string, 0, len(a.Layers))
|
||||
for name := range a.Layers {
|
||||
names = append(names, name)
|
||||
}
|
||||
slices.Sort(names)
|
||||
return names
|
||||
return slices.Sorted(maps.Keys(a.Layers))
|
||||
}
|
||||
|
||||
// AllTrainableParams returns all trainable arrays (A and B from every layer),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue