<jupyter_start><jupyter_text>Choose your sampler<jupyter_code>from pythae.samplers import NormalSampler
# create normal sampler
normal_samper = NormalSampler(
    model=trained_model
)
# sample
gen_data = normal_samper.sample(
    num_samples=25
)
import matplotlib.pyplot as plt
# show results with normal sampler
fig, axes = plt.subplots(nrows=5, ncols=5, figsize=(10, 10))

for i in range(5):
    for j in range(5):
        axes[i][j].imshow(gen_data[i*5 +j].cpu().squeeze(0), cmap='gray')
        axes[i][j].axis('off')
plt.tight_layout(pad=0.)
from pythae.samplers import GaussianMixtureSampler, GaussianMixtureSamplerConfig
# set up gmm sampler config
gmm_sampler_config = GaussianMixtureSamplerConfig(
    n_components=10
)

# create gmm sampler
gmm_sampler = GaussianMixtureSampler(
    sampler_config=gmm_sampler_config,
    model=trained_model
)

# fit the sampler
gmm_sampler.fit(train_dataset)
# sample
gen_data = gmm_sampler.sample(
    num_samples=25
)
# show results with gmm sampler
fig, axes = plt.subplots(nrows=5, ncols=5, figsize=(10, 10))

for i in range(5):
    for j in range(5):
        axes[i][j].imshow(gen_data[i*5 +j].cpu().squeeze(0), cmap='gray')
        axes[i][j].axis('off')
plt.tight_layout(pad=0.)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12440570522979398, 'fraction_numerical': 0.022187004754358162, 'mean_word_length': 5.1911764705882355, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '82924', 'license': 'Apache-2.0', 'n_tokens_mistral': 504, 'n_tokens_neox': 480, 'n_words': 96, 'path': 'examples/notebooks/models_training/info_vae_training.ipynb', 'repo_name': 'clementchadebec/benchmark_VAE', 'size': '1262'}