From b9faf92148c7e6432ff0411783f444b7779fa36a Mon Sep 17 00:00:00 2001 From: Jonas Knobloch Date: Mon, 6 Apr 2026 22:59:50 +0200 Subject: Handle environment initialization on package level --- gpt2/model.go | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'gpt2/model.go') diff --git a/gpt2/model.go b/gpt2/model.go index f492c56..d0d1c2f 100644 --- a/gpt2/model.go +++ b/gpt2/model.go @@ -60,12 +60,6 @@ func IntraOpNumThreads() int { } func (m *Model) Init() error { - ort.SetSharedLibraryPath(SharedLibraryPath()) - - if err := ort.InitializeEnvironment(); err != nil { - return err - } - m.allocator = NewAllocator(m.config, m.withCache, m.withLogits, m.withLogProbs) var options *ort.SessionOptions @@ -99,10 +93,8 @@ func (m *Model) Init() error { return nil } -func (m *Model) Destroy() error { +func (m *Model) Destroy() { m.allocator.Destroy() - - return ort.DestroyEnvironment() } func (m *Model) Generate(prompt []int64, steps int64, logits *[][]float32) ([]int64, error) { -- cgit v1.3.1