chore: use slices.Sorted(maps.Keys()) for ordered iteration
All checks were successful
Security Scan / security (pull_request) Successful in 13s
Test / Vet & Build (pull_request) Successful in 39s

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Claude 2026-02-24 16:32:47 +00:00
parent 85775dc082
commit eeec1fe372
No known key found for this signature in database
GPG key ID: AF404715446AEB41

View file

@ -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),