Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

请问有实现训练的分类器的保存吗 #2

Open
zcg-joker opened this issue Dec 19, 2022 · 2 comments
Open

请问有实现训练的分类器的保存吗 #2

zcg-joker opened this issue Dec 19, 2022 · 2 comments

Comments

@zcg-joker
Copy link

如题~

@zhulei227
Copy link
Owner

这部分功能没有做实现,可通过pickle保持模型参数,给个demo:

class Model(object):
    def __init__(self):
        self.w1#模型参数1
        self.w2#模型参数2
    def save(self,path):
        params=dict()
        params["w1"]=self.w1
        params["w2"]=self.w2
        with open(path, "wb") as f:
            pickle.dump(params, f)
    def load(self,path):
        with open(path, "rb") as f:
            params=pickle.load(f)
        self.w1=params["w1"]
        self.w2=params["w2"]

@zcg-joker
Copy link
Author

好嘞~谢谢!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants