data_bunch = DataBunch(train_dl=training_loader, valid_dl=validation_loader)

# =========================================================================================

classifier = mdl_ResDenHybrid()

class SGD_m5(SGD):
    def __init__(self, *args, **kwargs):
        super().__init__(momentum=0.5, *args, **kwargs)

learn = Learner(
    data_bunch,
    classifier,
    loss_func=Loss_combine_weighted_v2(),
    opt_func=SGD_m5,
    metrics=[Metric_grapheme(), Metric_vowel(), Metric_consonant(), Metric_tot()]
)

name = 'mdl_ResDenHybrid_sgd_lessaugs_mucm_fixed_raw_onecycle_fld1of5'

logger = CSVLogger(learn, name)

# =========================================================================================

learn.fit_one_cycle(
    160,
    max_lr=0.05,
    wd=0.0,
    pct_start=0.0,
    div_factor=50.,
    final_div=100.,
# ### model

classifier = Simple50GeM()

# In[8]:

logging_name = 'MG_model_script_ModelMg_SeperateHead_BestAugs_3ChSize128Pad3_OneCycle'

learn = Learner(data_bunch,
                classifier,
                loss_func=Loss_combine_weighted(),
                opt_func=Over9000,
                metrics=[
                    Metric_grapheme(),
                    Metric_vowel(),
                    Metric_consonant(),
                    Metric_tot()
                ])

logger = CSVLogger(learn, logging_name)

learn.clip_grad = 1.0
# learn.split([classifier.cls])
learn.unfreeze()

# In[9]:

learn.fit_one_cycle(160,
                    max_lr=1e-2,
                    wd=0.,
                    pct_start=0.0,