<jupyter_start><jupyter_text>Imports<jupyter_code>%reload_ext autoreload
%autoreload 2
%matplotlib inline
%pwd
from fastai import *
from fastai.text import *
from fastai.callbacks import *
get_ipython().config.get('IPKernelApp', {})['parent_appname'] = ""
path = Path('/home/hendrix/data/jhlm/')
df = pd.read_csv(path/'alllessons2.csv')<jupyter_output><empty_output><jupyter_text>Data<jupyter_code>df.head()
data_lm = (TextList.from_csv(path, 'alllessons2.csv', cols='text')
                .split_by_rand_pct(0.2)
                .label_for_lm()
                .databunch(bs=64))
data_lm.save('jhlm_lm.pkl')
data_lm.show_batch()<jupyter_output><empty_output><jupyter_text>Training  Train 1<jupyter_code>learn = language_model_learner(data_lm,AWD_LSTM,
                              path=path,
                              callback_fns=[partial(SaveModelCallback,every='epoch',name='jhlm2'),
                                           ShowGraph]).to_fp16()
learn.unfreeze()
learn.fit_one_cycle(10,1e-2,moms=(.8,.7))<jupyter_output><empty_output><jupyter_text>Train 2<jupyter_code>learn = language_model_learner(data_lm,AWD_LSTM,
                              path=path,
                              callback_fns=[partial(SaveModelCallback,every='epoch',name='jhlm3'),
                                           ShowGraph]).to_fp16()
learn.unfreeze()
learn.fit_one_cycle(10,1e-2,moms=(.8,.7))<jupyter_output><empty_output><jupyter_text>predict<jupyter_code>print(learn.predict('this is really cool',30,temperature=.3))
print(learn.predict('this is really cool',30,temperature=.4))
learn.save('jhlm_test')
learn.load('jhlm_test')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14096385542168674, 'fraction_numerical': 0.019879518072289156, 'mean_word_length': 3.613888888888889, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '583383', 'license': 'Apache-2.0', 'n_tokens_mistral': 609, 'n_tokens_neox': 591, 'n_words': 55, 'path': 'nbs/ubuntu/training-awd4.ipynb', 'repo_name': 'pattyhendrix/MiniJereme', 'size': '1660'}