Is there a way to just pull out the embeddings learned from a LanguageModelData?

Is there a way to pull out these embeddings to use elsewhere?

Thanks!

2 Likes

Late reply and ugly solution but never the less - the way to extract embedding matrices from structured data model, probably language model won’t be different

m = model.get_learner(emb_szs=emb_szs, n_cont=len(df_train.columns)-len(cat_vars),
           emb_drop=0.04, out_sz=2, szs=[1000,500], drops=[0.001,0.01], y_range=[0, 1])
emb_lst = []
for o in m.model.embs.parameters():
    lst.append(o.data.numpy())