fastai2/learner.py
def export(self:Learner, fname='export.pkl'):
    "Export the content of `self` without the items and the optimizer state for inference"
    if rank_distrib(): return # don't export if slave proc
    old_dbunch = self.dls
    self.dls = self.dls.new_empty()
    state = self.opt.state_dict()
    self.opt = None
    with warnings.catch_warnings():
        #To avoid the warning that come from PyTorch about model not being checked
        warnings.simplefilter("ignore")
        torch.save(self, self.path/fname)
    self.create_opt()
    self.opt.load_state_dict(state)
    self.dls = old_dbunch
Export the content of `self` without the items and the optimizer state for inference
Export the content of `self` without the items and the optimizer state for inference
Export the content of ` self ` without the items and the optimizer state for inference
def export(self:Learner, fname='export.pkl'):
    if rank_distrib(): return 
    old_dbunch = self.dls
    self.dls = self.dls.new_empty()
    state = self.opt.state_dict()
    self.opt = None
    with warnings.catch_warnings():
        warnings.simplefilter("ignore")
        torch.save(self, self.path/fname)
    self.create_opt()
    self.opt.load_state_dict(state)
    self.dls = old_dbunch
def export ( self : Learner , fname = 'export.pkl' ) : if rank_distrib ( ) : return old_dbunch = self . dls self . dls = self . dls . new_empty ( ) state = self . opt . state_dict ( ) self . opt = None with warnings . catch_warnings ( ) : warnings . simplefilter ( "ignore" ) torch . save ( self , self . path / fname ) self . create_opt ( ) self . opt . load_state_dict ( state ) self . dls = old_dbunch
Export the content of `self` without the items and the optimizer state for inference
Export the content of ` self ` without the items and the optimizer state for inference
"Export the content of `self` without the items and the optimizer state for inference" # don't export if slave proc #To avoid the warning that come from PyTorch about model not being checked
self
Learner
fname