<jupyter_start><jupyter_text>optimizer.save_states("model/model of executor"),model.save_parameters("model/model of executor")<jupyter_code>val_set = PartPrimitive(opt.val_file)
val_loader = gdata.DataLoader(
    dataset=val_set,
    batch_size=opt.batch_size,
    shuffle=True,
    num_workers=opt.num_workers,
)
print("testing")
for epoch in range(1, opt.epochs+1):
    gen_shapes, ori_shapes = validate(epoch, val_loader, model,
                                      loss, opt,ctx, val_loss,val_iou, gen_shape=True)
    gen_shapes = (gen_shapes > 0.5)
    gen_shapes = gen_shapes.astype(np.float32)
    iou = BatchIoU(ori_shapes, gen_shapes)
    print("Mean IoU: {:.3f}".format(iou.mean()))

gen_shapes, ori_shapes = validate(epoch, val_loader, model,
                                      loss, opt,ctx, val_loss,val_iou, gen_shape=True)
gen_shapes = (gen_shapes > 0.5)
gen_shapes = gen_shapes.astype(np.float32)
iou = BatchIoU(ori_shapes, gen_shapes)
print("Mean IoU: {:.3f}".format(iou.mean().asscalar()))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13256484149855907, 'fraction_numerical': 0.011527377521613832, 'mean_word_length': 4.058252427184466, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '607623', 'license': 'MIT', 'n_tokens_mistral': 408, 'n_tokens_neox': 399, 'n_words': 58, 'path': 'train_shape_executor.ipynb', 'repo_name': 'huzhouxiang/shape2gram-mxnet', 'size': '1041'}