<commit_before>#%%
from matplotlib import pyplot as plt
from scipy.ndimage import zoom

import keras

from eva.layers.masked_convolution2d import MaskedConvolution2D
from eva.layers.fuckingsoftmax import FuckingSoftmax
from eva.util.mutil import generate

count = 10

model = keras.models.load_model('eva/examples/model.h5', custom_objects={'MaskedConvolution2D':MaskedConvolution2D, 'FuckingSoftmax':FuckingSoftmax})

import numpy as np
pixels = np.zeros(shape=model.input_shape[1:])
rows, cols, channels = pixels.shape
for row in range(rows):
    for col in range(cols):
        pixels[row, col, 0] = np.random.choice(256, p=model.predict_on_batch(pixels[np.newaxis])[0][row*cols+col])
pixels = pixels[:, :, 0]

plt.imshow(zoom(pixels, 3, order=0), interpolation='lanczos')
plt.show()

#%%
for image in [generate(model) for _ in range(count)]:
    plt.imshow(image, interpolation='nearest')
    plt.show()<commit_msg>Clean up infer<commit_after>#%%
from matplotlib import pyplot as plt
from scipy.ndimage import zoom

import keras

from eva.layers.masked_convolution2d import MaskedConvolution2D
from eva.util.mutil import generate

count = 10

model = keras.models.load_model('eva/examples/model.h5', custom_objects={'MaskedConvolution2D':MaskedConvolution2D})

#%%
for image in [generate(model) for _ in range(count)]:
    plt.imshow(image, interpolation='nearest')
    plt.show()
{'fraction_non_alphanumeric': 0.12138728323699421, 'fraction_numerical': 0.016618497109826588, 'mean_word_length': 6.030456852791878, 'pattern_counts': {'":': 0, '<': 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': '1837342', 'n_tokens_mistral': 497, 'n_tokens_neox': 482, 'n_words': 109}