<commit_before>import cPickle as pk

if __name__ == "__main__":
    f = open('./data/FB15k_entity2idx.pkl')
    ent2idx = pk.load(f) # a dic from entity to index
    f.close()
    f = open('./data/FB15k_idx2entity.pkl')
    idx2ent = pk.load(f) # a dic from entity to index
    f.close()

    f = open('./FB15k/prescription/best_valid_model.pkl')
    embedding = pk.load(f)
<commit_msg>pickle bug<commit_after>import cPickle as pk
from model import *

if __name__ == "__main__":
    f = open('./data/FB15k_entity2idx.pkl')
    ent2idx = pk.load(f) # a dic from entity to index
    f.close()
    f = open('./data/FB15k_idx2entity.pkl')
    idx2ent = pk.load(f) # a dic from entity to index
    f.close()

    f = open('./FB15k/prescription/best_valid_model.pkl')
    embeddings = pk.load(f)
    embedding, relationl, relationr = parse_embeddings(embeddings)
    embedding = embedding.E.get_value()
    f.close()
    
    shape = embedding.shape
    f = open('embedding.txt', 'w')
    for i in range(shape[1]):
        for j in range(shape[0]):
            f.write(str(embedding[j][i]) + ' ')
        f.write('\n')
    f.close()
{'fraction_non_alphanumeric': 0.1492007104795737, 'fraction_numerical': 0.019538188277087035, 'mean_word_length': 2.84641638225256, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5784921', 'n_tokens_mistral': 433, 'n_tokens_neox': 426, 'n_words': 93}