Interactive online version: Binder badge Google Colab badge

Thai Wiki Language Model for Text Generation

This notebook details how you can use pretrained language model on Thai Wikipedia Dump to generate texts.

[ ]:
# #uncomment if you are running from google colab
# !pip install pythainlp
# !pip install fastai
# !pip install emoji
[ ]:
import pandas as pd
import numpy as np
from ast import literal_eval
from tqdm import tqdm_notebook
from collections import Counter
import re

import matplotlib.pyplot as plt
import seaborn as sns

import fastai
from fastai.text import *
from fastai.callbacks import CSVLogger

from pythainlp.ulmfit import *
[ ]:
try:
  THWIKI_LSTM = _THWIKI_LSTM
except:
  THWIKI_LSTM = THWIKI_LSTM
[7]:
#get dummy data
imdb = untar_data(URLs.IMDB_SAMPLE)
dummy_df = pd.read_csv(imdb/'texts.csv')

#get vocab
thwiki_itos = pickle.load(open(THWIKI_LSTM['itos_fname'], 'rb'))
thwiki_vocab = fastai.text.transform.Vocab(thwiki_itos)

#dummy databunch
tt = Tokenizer(tok_func=ThaiTokenizer, lang='th', pre_rules=pre_rules_th, post_rules=post_rules_th)
processor = [TokenizeProcessor(tokenizer=tt, chunksize=10000, mark_fields=False),
            NumericalizeProcessor(vocab=thwiki_vocab, max_vocab=60000, min_freq=3)]
data_lm = (TextList.from_df(dummy_df, imdb, cols=['text'], processor=processor)
    .split_by_rand_pct(0.2)
    .label_for_lm()
    .databunch(bs=64))

data_lm.sanity_check()
[8]:
#check vocab size
len(data_lm.vocab.itos)
[8]:
60005
[9]:
config = dict(emb_sz=400, n_hid=1550, n_layers=4, pad_token=1, qrnn=False, tie_weights=True, out_bias=True,
             output_p=0.25, hidden_p=0.1, input_p=0.2, embed_p=0.02, weight_p=0.15)
trn_args = dict(drop_mult=0.9, clip=0.12, alpha=2, beta=1)

learn = language_model_learner(data_lm, AWD_LSTM, config=config, pretrained=False, **trn_args)

#load pretrained models
learn.load_pretrained(**THWIKI_LSTM)
[9]:
LanguageLearner(data=TextLMDataBunch;

Train: LabelList (800 items)
x: LMTextList
xxbos   this   is   a   xxunk   xxunk   film .   the   acting ,   script   and   xxunk   are   all   xxunk .   the   music   is   good ,   too ,   though   it   is   mostly   early   in   the   film ,   when   things   are   still   xxunk   xxunk .   there   are   no   really   superstars   in   the   cast ,   though   several   faces   will   be   xxunk .   the   entire   cast   does   an   excellent   job   with   the   script .

   but   it   is   hard   to   watch ,   because   there   is   no   good   end   to   a   situation   like   the   one   presented .   it   is   now   xxunk   to   xxunk   the   british   for   setting   xxunk   and   xxunk   against   each   other ,   and   then   xxunk   xxunk   them   into   two   countries .   there   is   some   merit   in   this   view ,   but   it ' s   also   true   that   no   one   forced   xxunk   and   xxunk   in   the   region   to   xxunk   each   other   as   they   did   around   the   time   of   partition .   it   xxunk   more   xxunk   that   the   british   simply   saw   the   xxunk   between   the   xxunk   and   were   xxunk   enough   to   xxunk   them   to   their   own   ends .

   the   result   is   that   there   is   much   xxunk   and   xxunk   in   the   situation   and   this   is   very   xxunk   to   remember   and   to   see   on   the   screen .   but   it   is   never   painted   as   a   xxunk   case .   there   is   xxunk   and   xxunk   on   both   sides ,   and   also   the   hope   for   change   in   the   younger   generation .

   there   is   redemption   of   a   sort ,   in   the   end ,   when   xxunk   has   to   make   a   hard   choice   between   a   man   who   has   xxunk   her   life ,   but   also   truly   loved   her ,   and   her   family   which   has   xxunk   her ,   then   later   come   looking   for   her .   but   by   that   point ,   she   has   no   option   that   is   without   great   pain   for   her .

   this   film   carries   the   message   that   both   xxunk   and   xxunk   have   their   grave   xxunk ,   and   also   that   both   can   be   xxunk   and   xxunk   people .   the   reality   of   partition   makes   that   xxunk   all   the   more   xxunk ,   since   there   can   never   be   real   xxunk   across   the   india   /   pakistan   border .   in   that   sense ,   it   is   similar   to   " mr   &   mrs   xxunk ".

   in   the   end ,   we   were   glad   to   have   seen   the   film ,   even   though   the   resolution   was   xxunk .   if   the   uk   and   us   could   deal   with   their   own   xxunk   of   xxunk   with   this   kind   of   xxunk ,   they   would   xxunk   be   better   off .,xxbos   every   once   in   a   long   while   a   movie   will   come   along   that   will   be   so   xxunk   that   i   feel   xxunk   to   xxunk   people .   if   i   labor   all   my   days   and   i   can   save   but   one   soul   from   xxunk   this   movie ,   how   great   will   be   my   joy .

   where   to   begin   my   xxunk   of   pain .   for   xxunk ,   there   was   a   musical   xxunk   every   five   minutes .   there   was   no   character   development .   every   character   was   a   stereotype .   we   had   xxunk   guy ,   fat   guy   who   xxunk   xxunk ,   xxunk   foreign   guy ,   etc .   the   script   xxunk   as   if   it   were   being   written   as   the   movie   was   being   shot .   the   production   value   was   so   xxunk   low   that   it   xxunk   like   i   was   xxunk   a   junior   high   video   presentation .   have   the   directors ,   producers ,   etc .   ever   even   seen   a   movie   before ?   xxunk   is   getting   worse   and   worse   with   every   new   entry .   the   concept   for   this   movie   xxunk   so   funny .   how   could   you   go   wrong   with   gary   coleman   and   a   xxunk   of   xxunk   xxunk   actors .   but   trust   me   when   i   say   this ,   things   went   wrong ,   very   wrong .,xxbos   name   just   says   it   all .   i   xxunk   this   movie   with   my   dad   when   it   came   out   and   having   xxunk   in   korea   he   had   great   xxunk   for   the   man .   the   xxunk   thing   about   this   film   is   that   it   only   xxunk   on   a   short   period   of   the   man ' s   life   -   xxunk   enough   the   man ' s   entire   life   would   have   made   such   an   epic   xxunk   that   it   is   xxunk   to   imagine   the   cost   for   production .

   some   xxunk   xxunk   to   the   xxunk   xxunk   about   the   man ,   which   are   cheap   xxunk .   the   theme   of   the   movie   " duty ,   honor ,   country "   are   not   just   xxunk   words   xxunk   from   the   lips   of   a   xxunk   officer   -   it   is   the   deep   declaration   of   one   man ' s   total   xxunk   to   his   country .

   xxunk   peck   being   the   liberal   that   he   was   xxunk   a   better   understanding   of   the   man .   he   does   a   great   job   xxunk   the   fearless   general   xxunk   with   the   humane   side   of   the   man .,xxbos   this   movie   xxunk   at   being   one   of   the   most   unique   movies   you ' ve   seen .   however   this   comes   from   the   fact   that   you   can ' t   make   heads   or   tails   of   this   mess .   it   almost   xxunk   as   a   series   of   challenges   set   up   to   xxunk   xxunk   or   not   you   are   xxunk   to   walk   out   of   the   movie   and   give   up   the   money   you   just   paid .   if   you   don ' t   want   to   feel   xxunk   you ' ll   sit   through   this   xxunk   film   and   xxunk   a   real   sense   of   xxunk   for   the   actors   xxunk ,   they ' ve   all   seen   better   days ,   but   then   you   xxunk   they   xxunk   got   paid   xxunk   a   bit   of   money   to   do   this   and   you ' ll   lose   xxunk   for   them   just   like   you ' ve   xxunk   done   for   the   film .   i   can ' t   go   on   enough   about   this   xxunk   movie ,   its   almost   something   that   ed   wood   would   have   made   and   in   that   case   it   xxunk   would   have   been   his   xxunk .

   to   start   you   are   forced   to   sit   through   an   opening   dialogue   the   xxunk   of   which   you ' ve   never   seen   /   heard ,   this   thing   has   got   to   be   five   minutes   long .   on   top   of   that   it   is   xxunk ,   as   to   xxunk   that   you   the   viewer   cannot   read .   then   we   meet   mr .   xxunk   and   the   xxunk   of   xxunk   lines   gets   xxunk ,   it   is   as   if   he   is   operating   xxunk   to   get   lines   on   to   the   movie   xxunk   tag   line .   soon   we   meet   stephen   xxunk ,   who   i   xxunk   xxunk )   and   he   does   his   best   not   to   xxunk   in   this   but   xxunk   he   does .   then   comes   the   ultimate   xxunk ,   tara   reid   playing   an   intelligent   role ,   oh   help   us !   tara   reid   is   not   a   very   talented   actress   and   xxunk   she   xxunk   gets   xxunk   in   movies ,   in   my   xxunk   though   she   should   stick   to   movies   of   the   american   pie   type .

   all   in   all   you   just   may   want   to   see   this   for   yourself   when   it   comes   out   on   video ,   i   know   that   i   got   a   kick   out   of   it ,   i   mean   xxunk   all   be   xxunk   here ,   xxunk   its   xxunk   to   xxunk   in   the   xxunk   of   others .,xxbos   from   the   start ,   you   know   how   this   movie   will   end .   it ' s   so   full   of   clich é s   your   typical   xxunk   member   will   not   even   like   this   movie .   i   give   it   2   out   of   10,   only   because   of   the   acting   of   william   benton .   i   can ' t   believe   people   xxunk   6 +   for   this   movie .   it ' s   so   biased   towards   a   ' certain   point   of   view '   ( once   a   thief xxunk   people   xxunk ' t   born   bad .   neither   are   they   born   good .   they   are   born   with   a   clean   slate .   it ' s   society ,   parents   and   education   what   makes   them   who   they   are .   and   if   they   take   the   wrong   turn ,   somewhere   down   the   line ,   it   xxunk   isn ' t   going   to   be   the   american   xxunk   system   that   gets   them   back   on   track !   xxunk ,   xxunk   this   movie   like   the   xxunk .   i   bet   you   have   better   things   to   do   with   your   time   than   waste   it   on   this   piece   of   xxunk .


y: LMLabelList
,,,,
Path: /root/.fastai/data/imdb_sample;

Valid: LabelList (200 items)
x: LMTextList
xxbos   xxunk   was   a   show   i   xxunk   up   with .   from   late   night   xxunk   with   penn   and   teller   to   the   one ,   the   only ,   joe   bob   xxunk .   the   show   xxunk   me   up   friday   nights   back   in   my   high   school   years ,   and   provided   some   of   the   best   xxunk   memories   to   ever   come   outside   of   the   xxunk .

   without   a   doubt ,   the   best   late   night   television   ever .   if   you   didn ' t   stay   up ,   you   were   missing   out .

   i   know   john   bloom   and   joe   bob   live   on ,   but   i   want   them   back   where   they   belong xxunk xxunk !   question xxunk did   anyone   else   sit   through   all   4   hours   of   " the   xxunk "   ?   q :)

   long   live   xxunk !,xxbos   the   xxunk   between   the   characters   is   a   moral   disaster .   you   end   up   xxunk   most   of   the   characters   and   you   don ' t   xxunk   like   any   of   them .

   even   the   two   main   characters   played   by   david   and   xxunk   are   so   xxunk   written   that   you   really   don ' t   care   one   bit   about   them .   the   movie   has   no   plot ,   no   direction   and   no   purpose .   the   single   xxunk   quality   of   the   movie   was   to   treat   it   as   a   xxunk   into   the   xxunk   up   lives   of   a   few   xxunk   -   and   that ' s   xxunk   xxunk   even   as   an   afternoon   waste .,xxbos   for   a   low   budget   project ,   the   film   was   a   success .   the   story   is   xxunk ,   and   the   actors   were   xxunk .   eva   xxunk ,   who   now   stars   on   the   tv   show   " xxunk ,"   is   xxunk   than   ever .   the   xxunk   were   ideal   for   the   xxunk   plot ,   and   the   director   shows   his   talent   by   taking   on   many   xxunk   for   his   project .   of   course   this   low   budget   film   could   use   better   editing   xxunk   and   more   special   effects   for   the   gun   scenes ,   but   the   music   xxunk   this   script   moving .   although   this   film   has   it ' s   share   of   problems ,   such   as   xxunk ,   i   must   say   that   i   would   rent   the   director ' s   next   movie .   if   your   a   film   student ,   you   could   learn   a   few   things   from   the   director ' s   xxunk .,xxbos   yes ,   he   is !   xxunk no ,   not   because   of   xxunk   xxunk   to   xxunk   his   actors   and   show   xxunk   their   xxunk .   xxunk   is   the   naked   " emperor "   -   so   to   speak xxunk

   it ' s   big   time   for   someone   to   state   the   truth .   this   xxunk   is   a   xxunk ,   a   xxunk   xxunk   in   an   old   man ' s   body .   his   xxunk   of   nude   scenes   have   no   artistic   xxunk   xxunk .   it   is   100 %   visual   xxunk :   he   gets   his   kicks   by   making   the   actors   strip   in   the   xxunk   and   look   at   their   xxunk .   and   if   he   does   this   in   front   of   the   audience ,   he   might   eve   get   a   xxunk !   did   you   know   that ,   on   the   set   of   " xxunk   xxunk ",   he   used   to   xxunk   poor   xxunk   xxunk ,   by   xxunk   her :   " oh ,   xxunk ,   how   i   wanna   f xxunk   you xxunk   she   is   a   great   lady ,   very   xxunk   and   sensitive ,   and   she   became   xxunk   xxunk   -   to   his   petty   satisfaction !   and ,   as   a   xxunk   alarm   signal   about   the   degree   of   xxunk   and   xxunk   of   education   in   xxunk   xxunk ,   so   many   people   are   still   so   xxunk   to   xxunk   these   visual   xxunk   " works   of   art "!   will   anyone   have   ever   the   xxunk   to   xxunk   the   truth   of   it   all ?,xxbos   an   excellent   film   xxunk   the   cross   xxunk   in   the   lives   of   a   xxunk   mix   of   not   so   ordinary   people   in   the   rural   pacific   northwest .   solid   xxunk   and   writing   along   with   fine   acting ,   xxunk   the   performances   by   xxunk   xxunk   and   dan   xxunk .   xxunk ,   this   film   was   made   in   the   same   year   as   the   highly   successful   " crash ,"   written   and   directed   by   paul   xxunk .   the   pace   of   the   action   may   not   be   as   xxunk   as   that   in   urban   los   angeles ,   and   the   characters   may   xxunk   to   be   better   xxunk   with   each   other   in   " apart   from   that ,"   but   the   personal   relationships   of   the   characters   are   as   xxunk   and   xxunk   and   their   stories   as   xxunk   as   any   of   those   in   " crash ."   for   those   xxunk   who   xxunk   " crash "   this   is   a   must   see   film .   also ,   xxunk   of   jim   xxunk   and   john   xxunk   will   like   this   movie .
y: LMLabelList
,,,,
Path: /root/.fastai/data/imdb_sample;

Test: None, model=SequentialRNN(
  (0): AWD_LSTM(
    (encoder): Embedding(60005, 400, padding_idx=1)
    (encoder_dp): EmbeddingDropout(
      (emb): Embedding(60005, 400, padding_idx=1)
    )
    (rnns): ModuleList(
      (0): WeightDropout(
        (module): LSTM(400, 1550, batch_first=True)
      )
      (1): WeightDropout(
        (module): LSTM(1550, 1550, batch_first=True)
      )
      (2): WeightDropout(
        (module): LSTM(1550, 1550, batch_first=True)
      )
      (3): WeightDropout(
        (module): LSTM(1550, 400, batch_first=True)
      )
    )
    (input_dp): RNNDropout()
    (hidden_dps): ModuleList(
      (0): RNNDropout()
      (1): RNNDropout()
      (2): RNNDropout()
      (3): RNNDropout()
    )
  )
  (1): LinearDecoder(
    (decoder): Linear(in_features=400, out_features=60005, bias=True)
    (output_dp): RNNDropout()
  )
), opt_func=functools.partial(<class 'torch.optim.adam.Adam'>, betas=(0.9, 0.99)), loss_func=FlattenedLoss of CrossEntropyLoss(), metrics=[<function accuracy at 0x7f5215ef6ea0>], true_wd=True, bn_wd=True, wd=0.01, train_bn=True, path=PosixPath('/root/.fastai/data/imdb_sample'), model_dir='models', callback_fns=[functools.partial(<class 'fastai.basic_train.Recorder'>, add_time=True, silent=False), functools.partial(<class 'fastai.train.GradientClipping'>, clip=0.12)], callbacks=[RNNTrainer
learn: LanguageLearner(data=TextLMDataBunch;

Train: LabelList (800 items)
x: LMTextList
xxbos   this   is   a   xxunk   xxunk   film .   the   acting ,   script   and   xxunk   are   all   xxunk .   the   music   is   good ,   too ,   though   it   is   mostly   early   in   the   film ,   when   things   are   still   xxunk   xxunk .   there   are   no   really   superstars   in   the   cast ,   though   several   faces   will   be   xxunk .   the   entire   cast   does   an   excellent   job   with   the   script .

   but   it   is   hard   to   watch ,   because   there   is   no   good   end   to   a   situation   like   the   one   presented .   it   is   now   xxunk   to   xxunk   the   british   for   setting   xxunk   and   xxunk   against   each   other ,   and   then   xxunk   xxunk   them   into   two   countries .   there   is   some   merit   in   this   view ,   but   it ' s   also   true   that   no   one   forced   xxunk   and   xxunk   in   the   region   to   xxunk   each   other   as   they   did   around   the   time   of   partition .   it   xxunk   more   xxunk   that   the   british   simply   saw   the   xxunk   between   the   xxunk   and   were   xxunk   enough   to   xxunk   them   to   their   own   ends .

   the   result   is   that   there   is   much   xxunk   and   xxunk   in   the   situation   and   this   is   very   xxunk   to   remember   and   to   see   on   the   screen .   but   it   is   never   painted   as   a   xxunk   case .   there   is   xxunk   and   xxunk   on   both   sides ,   and   also   the   hope   for   change   in   the   younger   generation .

   there   is   redemption   of   a   sort ,   in   the   end ,   when   xxunk   has   to   make   a   hard   choice   between   a   man   who   has   xxunk   her   life ,   but   also   truly   loved   her ,   and   her   family   which   has   xxunk   her ,   then   later   come   looking   for   her .   but   by   that   point ,   she   has   no   option   that   is   without   great   pain   for   her .

   this   film   carries   the   message   that   both   xxunk   and   xxunk   have   their   grave   xxunk ,   and   also   that   both   can   be   xxunk   and   xxunk   people .   the   reality   of   partition   makes   that   xxunk   all   the   more   xxunk ,   since   there   can   never   be   real   xxunk   across   the   india   /   pakistan   border .   in   that   sense ,   it   is   similar   to   " mr   &   mrs   xxunk ".

   in   the   end ,   we   were   glad   to   have   seen   the   film ,   even   though   the   resolution   was   xxunk .   if   the   uk   and   us   could   deal   with   their   own   xxunk   of   xxunk   with   this   kind   of   xxunk ,   they   would   xxunk   be   better   off .,xxbos   every   once   in   a   long   while   a   movie   will   come   along   that   will   be   so   xxunk   that   i   feel   xxunk   to   xxunk   people .   if   i   labor   all   my   days   and   i   can   save   but   one   soul   from   xxunk   this   movie ,   how   great   will   be   my   joy .

   where   to   begin   my   xxunk   of   pain .   for   xxunk ,   there   was   a   musical   xxunk   every   five   minutes .   there   was   no   character   development .   every   character   was   a   stereotype .   we   had   xxunk   guy ,   fat   guy   who   xxunk   xxunk ,   xxunk   foreign   guy ,   etc .   the   script   xxunk   as   if   it   were   being   written   as   the   movie   was   being   shot .   the   production   value   was   so   xxunk   low   that   it   xxunk   like   i   was   xxunk   a   junior   high   video   presentation .   have   the   directors ,   producers ,   etc .   ever   even   seen   a   movie   before ?   xxunk   is   getting   worse   and   worse   with   every   new   entry .   the   concept   for   this   movie   xxunk   so   funny .   how   could   you   go   wrong   with   gary   coleman   and   a   xxunk   of   xxunk   xxunk   actors .   but   trust   me   when   i   say   this ,   things   went   wrong ,   very   wrong .,xxbos   name   just   says   it   all .   i   xxunk   this   movie   with   my   dad   when   it   came   out   and   having   xxunk   in   korea   he   had   great   xxunk   for   the   man .   the   xxunk   thing   about   this   film   is   that   it   only   xxunk   on   a   short   period   of   the   man ' s   life   -   xxunk   enough   the   man ' s   entire   life   would   have   made   such   an   epic   xxunk   that   it   is   xxunk   to   imagine   the   cost   for   production .

   some   xxunk   xxunk   to   the   xxunk   xxunk   about   the   man ,   which   are   cheap   xxunk .   the   theme   of   the   movie   " duty ,   honor ,   country "   are   not   just   xxunk   words   xxunk   from   the   lips   of   a   xxunk   officer   -   it   is   the   deep   declaration   of   one   man ' s   total   xxunk   to   his   country .

   xxunk   peck   being   the   liberal   that   he   was   xxunk   a   better   understanding   of   the   man .   he   does   a   great   job   xxunk   the   fearless   general   xxunk   with   the   humane   side   of   the   man .,xxbos   this   movie   xxunk   at   being   one   of   the   most   unique   movies   you ' ve   seen .   however   this   comes   from   the   fact   that   you   can ' t   make   heads   or   tails   of   this   mess .   it   almost   xxunk   as   a   series   of   challenges   set   up   to   xxunk   xxunk   or   not   you   are   xxunk   to   walk   out   of   the   movie   and   give   up   the   money   you   just   paid .   if   you   don ' t   want   to   feel   xxunk   you ' ll   sit   through   this   xxunk   film   and   xxunk   a   real   sense   of   xxunk   for   the   actors   xxunk ,   they ' ve   all   seen   better   days ,   but   then   you   xxunk   they   xxunk   got   paid   xxunk   a   bit   of   money   to   do   this   and   you ' ll   lose   xxunk   for   them   just   like   you ' ve   xxunk   done   for   the   film .   i   can ' t   go   on   enough   about   this   xxunk   movie ,   its   almost   something   that   ed   wood   would   have   made   and   in   that   case   it   xxunk   would   have   been   his   xxunk .

   to   start   you   are   forced   to   sit   through   an   opening   dialogue   the   xxunk   of   which   you ' ve   never   seen   /   heard ,   this   thing   has   got   to   be   five   minutes   long .   on   top   of   that   it   is   xxunk ,   as   to   xxunk   that   you   the   viewer   cannot   read .   then   we   meet   mr .   xxunk   and   the   xxunk   of   xxunk   lines   gets   xxunk ,   it   is   as   if   he   is   operating   xxunk   to   get   lines   on   to   the   movie   xxunk   tag   line .   soon   we   meet   stephen   xxunk ,   who   i   xxunk   xxunk )   and   he   does   his   best   not   to   xxunk   in   this   but   xxunk   he   does .   then   comes   the   ultimate   xxunk ,   tara   reid   playing   an   intelligent   role ,   oh   help   us !   tara   reid   is   not   a   very   talented   actress   and   xxunk   she   xxunk   gets   xxunk   in   movies ,   in   my   xxunk   though   she   should   stick   to   movies   of   the   american   pie   type .

   all   in   all   you   just   may   want   to   see   this   for   yourself   when   it   comes   out   on   video ,   i   know   that   i   got   a   kick   out   of   it ,   i   mean   xxunk   all   be   xxunk   here ,   xxunk   its   xxunk   to   xxunk   in   the   xxunk   of   others .,xxbos   from   the   start ,   you   know   how   this   movie   will   end .   it ' s   so   full   of   clich é s   your   typical   xxunk   member   will   not   even   like   this   movie .   i   give   it   2   out   of   10,   only   because   of   the   acting   of   william   benton .   i   can ' t   believe   people   xxunk   6 +   for   this   movie .   it ' s   so   biased   towards   a   ' certain   point   of   view '   ( once   a   thief xxunk   people   xxunk ' t   born   bad .   neither   are   they   born   good .   they   are   born   with   a   clean   slate .   it ' s   society ,   parents   and   education   what   makes   them   who   they   are .   and   if   they   take   the   wrong   turn ,   somewhere   down   the   line ,   it   xxunk   isn ' t   going   to   be   the   american   xxunk   system   that   gets   them   back   on   track !   xxunk ,   xxunk   this   movie   like   the   xxunk .   i   bet   you   have   better   things   to   do   with   your   time   than   waste   it   on   this   piece   of   xxunk .


y: LMLabelList
,,,,
Path: /root/.fastai/data/imdb_sample;

Valid: LabelList (200 items)
x: LMTextList
xxbos   xxunk   was   a   show   i   xxunk   up   with .   from   late   night   xxunk   with   penn   and   teller   to   the   one ,   the   only ,   joe   bob   xxunk .   the   show   xxunk   me   up   friday   nights   back   in   my   high   school   years ,   and   provided   some   of   the   best   xxunk   memories   to   ever   come   outside   of   the   xxunk .

   without   a   doubt ,   the   best   late   night   television   ever .   if   you   didn ' t   stay   up ,   you   were   missing   out .

   i   know   john   bloom   and   joe   bob   live   on ,   but   i   want   them   back   where   they   belong xxunk xxunk !   question xxunk did   anyone   else   sit   through   all   4   hours   of   " the   xxunk "   ?   q :)

   long   live   xxunk !,xxbos   the   xxunk   between   the   characters   is   a   moral   disaster .   you   end   up   xxunk   most   of   the   characters   and   you   don ' t   xxunk   like   any   of   them .

   even   the   two   main   characters   played   by   david   and   xxunk   are   so   xxunk   written   that   you   really   don ' t   care   one   bit   about   them .   the   movie   has   no   plot ,   no   direction   and   no   purpose .   the   single   xxunk   quality   of   the   movie   was   to   treat   it   as   a   xxunk   into   the   xxunk   up   lives   of   a   few   xxunk   -   and   that ' s   xxunk   xxunk   even   as   an   afternoon   waste .,xxbos   for   a   low   budget   project ,   the   film   was   a   success .   the   story   is   xxunk ,   and   the   actors   were   xxunk .   eva   xxunk ,   who   now   stars   on   the   tv   show   " xxunk ,"   is   xxunk   than   ever .   the   xxunk   were   ideal   for   the   xxunk   plot ,   and   the   director   shows   his   talent   by   taking   on   many   xxunk   for   his   project .   of   course   this   low   budget   film   could   use   better   editing   xxunk   and   more   special   effects   for   the   gun   scenes ,   but   the   music   xxunk   this   script   moving .   although   this   film   has   it ' s   share   of   problems ,   such   as   xxunk ,   i   must   say   that   i   would   rent   the   director ' s   next   movie .   if   your   a   film   student ,   you   could   learn   a   few   things   from   the   director ' s   xxunk .,xxbos   yes ,   he   is !   xxunk no ,   not   because   of   xxunk   xxunk   to   xxunk   his   actors   and   show   xxunk   their   xxunk .   xxunk   is   the   naked   " emperor "   -   so   to   speak xxunk

   it ' s   big   time   for   someone   to   state   the   truth .   this   xxunk   is   a   xxunk ,   a   xxunk   xxunk   in   an   old   man ' s   body .   his   xxunk   of   nude   scenes   have   no   artistic   xxunk   xxunk .   it   is   100 %   visual   xxunk :   he   gets   his   kicks   by   making   the   actors   strip   in   the   xxunk   and   look   at   their   xxunk .   and   if   he   does   this   in   front   of   the   audience ,   he   might   eve   get   a   xxunk !   did   you   know   that ,   on   the   set   of   " xxunk   xxunk ",   he   used   to   xxunk   poor   xxunk   xxunk ,   by   xxunk   her :   " oh ,   xxunk ,   how   i   wanna   f xxunk   you xxunk   she   is   a   great   lady ,   very   xxunk   and   sensitive ,   and   she   became   xxunk   xxunk   -   to   his   petty   satisfaction !   and ,   as   a   xxunk   alarm   signal   about   the   degree   of   xxunk   and   xxunk   of   education   in   xxunk   xxunk ,   so   many   people   are   still   so   xxunk   to   xxunk   these   visual   xxunk   " works   of   art "!   will   anyone   have   ever   the   xxunk   to   xxunk   the   truth   of   it   all ?,xxbos   an   excellent   film   xxunk   the   cross   xxunk   in   the   lives   of   a   xxunk   mix   of   not   so   ordinary   people   in   the   rural   pacific   northwest .   solid   xxunk   and   writing   along   with   fine   acting ,   xxunk   the   performances   by   xxunk   xxunk   and   dan   xxunk .   xxunk ,   this   film   was   made   in   the   same   year   as   the   highly   successful   " crash ,"   written   and   directed   by   paul   xxunk .   the   pace   of   the   action   may   not   be   as   xxunk   as   that   in   urban   los   angeles ,   and   the   characters   may   xxunk   to   be   better   xxunk   with   each   other   in   " apart   from   that ,"   but   the   personal   relationships   of   the   characters   are   as   xxunk   and   xxunk   and   their   stories   as   xxunk   as   any   of   those   in   " crash ."   for   those   xxunk   who   xxunk   " crash "   this   is   a   must   see   film .   also ,   xxunk   of   jim   xxunk   and   john   xxunk   will   like   this   movie .
y: LMLabelList
,,,,
Path: /root/.fastai/data/imdb_sample;

Test: None, model=SequentialRNN(
  (0): AWD_LSTM(
    (encoder): Embedding(60005, 400, padding_idx=1)
    (encoder_dp): EmbeddingDropout(
      (emb): Embedding(60005, 400, padding_idx=1)
    )
    (rnns): ModuleList(
      (0): WeightDropout(
        (module): LSTM(400, 1550, batch_first=True)
      )
      (1): WeightDropout(
        (module): LSTM(1550, 1550, batch_first=True)
      )
      (2): WeightDropout(
        (module): LSTM(1550, 1550, batch_first=True)
      )
      (3): WeightDropout(
        (module): LSTM(1550, 400, batch_first=True)
      )
    )
    (input_dp): RNNDropout()
    (hidden_dps): ModuleList(
      (0): RNNDropout()
      (1): RNNDropout()
      (2): RNNDropout()
      (3): RNNDropout()
    )
  )
  (1): LinearDecoder(
    (decoder): Linear(in_features=400, out_features=60005, bias=True)
    (output_dp): RNNDropout()
  )
), opt_func=functools.partial(<class 'torch.optim.adam.Adam'>, betas=(0.9, 0.99)), loss_func=FlattenedLoss of CrossEntropyLoss(), metrics=[<function accuracy at 0x7f5215ef6ea0>], true_wd=True, bn_wd=True, wd=0.01, train_bn=True, path=PosixPath('/root/.fastai/data/imdb_sample'), model_dir='models', callback_fns=[functools.partial(<class 'fastai.basic_train.Recorder'>, add_time=True, silent=False), functools.partial(<class 'fastai.train.GradientClipping'>, clip=0.12)], callbacks=[...], layer_groups=[Sequential(
  (0): WeightDropout(
    (module): LSTM(400, 1550, batch_first=True)
  )
  (1): RNNDropout()
), Sequential(
  (0): WeightDropout(
    (module): LSTM(1550, 1550, batch_first=True)
  )
  (1): RNNDropout()
), Sequential(
  (0): WeightDropout(
    (module): LSTM(1550, 1550, batch_first=True)
  )
  (1): RNNDropout()
), Sequential(
  (0): WeightDropout(
    (module): LSTM(1550, 400, batch_first=True)
  )
  (1): RNNDropout()
), Sequential(
  (0): Embedding(60005, 400, padding_idx=1)
  (1): EmbeddingDropout(
    (emb): Embedding(60005, 400, padding_idx=1)
  )
  (2): LinearDecoder(
    (decoder): Linear(in_features=400, out_features=60005, bias=True)
    (output_dp): RNNDropout()
  )
)], add_time=True, silent=False)
alpha: 2
beta: 1], layer_groups=[Sequential(
  (0): WeightDropout(
    (module): LSTM(400, 1550, batch_first=True)
  )
  (1): RNNDropout()
), Sequential(
  (0): WeightDropout(
    (module): LSTM(1550, 1550, batch_first=True)
  )
  (1): RNNDropout()
), Sequential(
  (0): WeightDropout(
    (module): LSTM(1550, 1550, batch_first=True)
  )
  (1): RNNDropout()
), Sequential(
  (0): WeightDropout(
    (module): LSTM(1550, 400, batch_first=True)
  )
  (1): RNNDropout()
), Sequential(
  (0): Embedding(60005, 400, padding_idx=1)
  (1): EmbeddingDropout(
    (emb): Embedding(60005, 400, padding_idx=1)
  )
  (2): LinearDecoder(
    (decoder): Linear(in_features=400, out_features=60005, bias=True)
    (output_dp): RNNDropout()
  )
)], add_time=True, silent=False)
[10]:
print(learn.predict('กาลครั้งหนึ่งนานมาแล้ว ', 200, temperature=0.8, min_p=0.005, sep=''))
กาลครั้งหนึ่งนานมาแล้ว

 ช่วงสองหนุ่มที่มีฐานะร่ำรวย และเป็นลูกสาวของ ดร. นิโคลัส (รับบทโดย อลิสัน คิง) เป็นลูกชายคนโตของ นาย โอลิเวอร์ และ มารดา นิโคลัส ในช่วงแรก เขาเป็นพ่อของ โอลลี เขามีพ่อ และแม่ เป็นคนที่มีจิตใจอ่อนโยน และเป็นเพื่อนสนิทกับ ดร. คาลิส (โรส วิลสัน) ที่เป็นพ่อของเธอนั่นเอง

 ในปี ค.ศ. 1967 สมิธได้รับการเลี้ยงดูจาก จอร์จ สปีลเบิร์ก และ ซาร่า ซึ่งต่อมาก็ได้รับการดูแลจากแม่ ซึ่งทำให้เขามีทักษะด้านวิทยาศาสตร์และเทคโนโลยีสูง หลังจากสำเร็จการศึกษาจากมหาวิทยาลัยแล้ว โรส ได้เดินทางไปที่ ประเทศออสเตรเลีย เพื่อเป็นที่ปรึกษา และในช่วงนั้นเอง ที่ได้พบกับ คริส เจ โรส ผู้เป็นมารดา
[ ]: