<commit_before>#!/usr/bin/env python
#usage: show_weights.py model.pkl
from pylearn2.gui import get_weights_report
from optparse import OptionParser


parser = OptionParser()

parser.add_option("--rescale",dest='rescale',type='string',default="individual")
parser.add_option("--out",dest="out",type='string',default=None)
parser.add_option("--border", dest="border", action="store_true",default=False)

options, positional = parser.parse_args()

assert len(positional) == 1
path ,= positional

rescale = options.rescale
border = options.border

pv = get_weights_report.get_weights_report(model_path = path, rescale = rescale, border = border)

if options.out is None:
    pv.show()
else:
    pv.save(options.out)
<commit_msg>Attempt to rule out global/module level variables as source of multiprocessing crash.<commit_after>#!/usr/bin/env python
#usage: show_weights.py model.pkl
from pylearn2.gui import get_weights_report
from optparse import OptionParser

def main():
    parser = OptionParser()

    parser.add_option("--rescale",dest='rescale',type='string',default="individual")
    parser.add_option("--out",dest="out",type='string',default=None)
    parser.add_option("--border", dest="border", action="store_true",default=False)

    options, positional = parser.parse_args()

    assert len(positional) == 1
    path ,= positional

    rescale = options.rescale
    border = options.border

    pv = get_weights_report.get_weights_report(model_path = path, rescale = rescale, border = border)

    if options.out is None:
        pv.show()
    else:
        pv.save(options.out)

if __name__ == "__main__":
    main()
{'fraction_non_alphanumeric': 0.13398893669330056, 'fraction_numerical': 0.002458512599877074, 'mean_word_length': 5.029629629629629, 'pattern_counts': {'":': 1, '<': 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': '7567138', 'n_tokens_mistral': 528, 'n_tokens_neox': 503, 'n_words': 109}