diff options
| author | Jonas Knobloch <jonas.knobloch@t-online.de> | 2026-04-11 01:02:29 +0200 |
|---|---|---|
| committer | Jonas Knobloch <jonas.knobloch@t-online.de> | 2026-04-11 01:19:39 +0200 |
| commit | c89300777c4f3131e7b9779f940d288bc602a264 (patch) | |
| tree | 8348c17f439e2eddaaccc2a4fe4aa79c5bd0ae2f /gpt2 | |
| parent | 456f8218a2d167385ae5570b04d45fb1d73befa3 (diff) | |
Reset allocator values map on initialization error
Diffstat (limited to 'gpt2')
| -rw-r--r-- | gpt2/allocator.go | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/gpt2/allocator.go b/gpt2/allocator.go index 46d612d..41d2ba5 100644 --- a/gpt2/allocator.go +++ b/gpt2/allocator.go @@ -19,10 +19,10 @@ type Allocator struct { func NewAllocator(cfg Config, opts Options, batchSize int) *Allocator { return &Allocator{ - config: cfg, - options: opts, - batchSize: batchSize, - values: make(map[string]ort.Value), + config: cfg, + options: opts, + batchSize: batchSize, + values: make(map[string]ort.Value), } } @@ -98,12 +98,16 @@ func (a *Allocator) Init(tokens []int64) error { if err := a.initInputs(tokens); err != nil { a.Destroy() + a.values = make(map[string]ort.Value) + return err } if err := a.initOutputs(tokens); err != nil { a.Destroy() + a.values = make(map[string]ort.Value) + return err } |
