go-python: python加载预训练模型出错

go调用python
为什么在python文件的方法中加载预训练模型会出错?
(注释掉pred.py文件中加载预训练模型那两行就没问题,单独运行pred.py也没问题)

// test.go
package main

import (
    "fmt"
    "github.com/DataDog/go-python3"
    "log"
    "os"
    "time"
)

func main(){
    python3.Py_Initialize()
    if !python3.Py_IsInitialized() {
        fmt.Println("Error initializing the python interpreter")
        os.Exit(1)
    }
    defer python3.Py_Finalize()

    //code, err := python3.PyRun_AnyFile("/src/go-python3/py3/pred")
    //fmt.Println(code)

    path, _ := os.Getwd()
    fmt.Println(path + "/src/go-python3/py3")
    helloPy := ImportModule(path + "/src/go-python3/py3", "pred")
    if helloPy == nil {
        log.Fatalf("Py is nil")
        return
    }

    helloFunc := helloPy.GetAttrString("predFunc")
    if helloFunc == nil {
        log.Fatalf("Func is nil")
    }

    var args = python3.PyTuple_New(1)
    python3.PyTuple_SetItem(args, 0, python3.PyUnicode_FromString("213 321 43 124 "))
    helloPy3Str := helloFunc.Call(args, python3.Py_None)
    if helloPy3Str == nil {
        log.Fatalf("Py3Str is nil")
    }
    funcResultStr, _ := pythonRepr(helloPy3Str)
    fmt.Println("func result: " + funcResultStr)
}

func pythonRepr(o *python3.PyObject) (string, error) {
    if o == nil {
        return "", fmt.Errorf("object is nil")
    }
    s := o.Repr()
    if s == nil {
        python3.PyErr_Clear()
        return "", fmt.Errorf("failed to call Repr object method")
    }
    defer s.DecRef()
    return python3.PyUnicode_AsUTF8(s), nil
}

func ImportModule(dir, name string) *python3.PyObject {
    sysModule := python3.PyImport_ImportModule("sys")
    path := sysModule.GetAttrString("path")
    //pathStr, _ := pythonRepr(path)
    //log.Println("before add path is " + pathStr)
    python3.PyList_Insert(path, 0, python3.PyUnicode_FromString(""))
    python3.PyList_Insert(path, 0, python3.PyUnicode_FromString(dir))
    //pathStr, _ = pythonRepr(path)
    //log.Println("after add path is " + pathStr)
    return python3.PyImport_ImportModule(name)
}
# pred.py
import pickle
import torch
from model import * #我自己定义的模型

def predFunc(X):
    #无论使用下面两个哪一种都不行,joblib也不行
    loaded_model = pickle.load(open("model.dat","rb"))
    # a = torch.load('model_torch.pt')
    #...#
    return 1
print("-------------------------------------------")