<jupyter_start><jupyter_text>Test<jupyter_code>import matplotlib.pyplot as plt
from PIL import Image
from module.dun_datasets.image_loaders import get_image_loader
import torch
def show(image):
#     image = Image.open(RESULT_IMAGE_PATH)
    plt.figure(figsize= (12,12))
    plt.imshow(image)
    plt.axis('off')
    plt.show()
dataset = 'MNIST'
workers = 8
batch_size =256
data_dir = 'data'
_, train_loader, _, _, _, Ntrain = get_image_loader(dataset, batch_size=batch_size, cuda=True, workers=workers, data_dir=data_dir, distributed=False)

for i in train_loader:
    image_x = i[0]
    label_y = i[1]
    index = 2
#     print("image_x : ", image_x, image_x.size())
#     print("label_y : ", label_y, label_y.size())
    print("label_y : ", label_y[index])
    show(image_x[index].reshape(28, 28))
    target = label_y[index]
    one_hot = torch.nn.functional.one_hot(target)
    print("one_hot : ", one_hot)

    out = model(image_x)
    print(out.size())
    print(out)
    break
from module.resnet import MyResNet

model = MyResNet()
model<jupyter_output><empty_output><jupyter_text>define Path<jupyter_code>modelName = "jupyterTest"
MODEL_PATH = "./result/" + modelName + "/flow_last.pt"
RESULT_IMAGE_PATH = "./result/"+ modelName +"/var.png"<jupyter_output><empty_output><jupyter_text>train flow<jupyter_code>import os
os.environ['MKL_THREADING_LAYER'] = 'GNU'
!python3 train_image_flow.py --config ./config/config_mnist.yaml --output_folder $modelName --gpu 8<jupyter_output>add_uniform: false
batch: 256
cond_size: 512
condition_scale: 1
dataset: MNIST
epochs: 40
eval_data:
    count: 300
flow_modules: 32-32-32-32-32
image_task: true
inputDim: 10
linear_encode: false
linear_encode_m: 50
lr: 0.01
lr_scheduler: cos
output_folder: jupyterTest
position_encode: false
position_encode_m: 50
remark: ''
sample_count: 256
start_time: _04-26_14:51
time_seed: 0
uniform_rate: 0.1
uniform_scheduler: false
var_scale: 3
workers: 32

[34m[1mwandb[0m: Currently logged in as: [33mandy-su[0m (use `wandb login --relogin` to force relogin)
[34m[1mwandb[0m: wandb version 0.12.15 is available!  To upgrade, please run:
[34m[1mwandb[0m:  $ pip install wandb --upgrade
[34m[1mwandb[0m: Tracking run with wandb version 0.12.11
[34m[1mwandb[0m: Run data is saved locally in [35m[1m/mnt/train-data-5-hdd/andysu/DATA/project/UncertaintyFlow/wandb/run-20220426_065149-2kb5vx93[0m
[34m[1mwandb[0m: Run [1m`wandb offline`[0m to turn off syncing.
[34m[1mwandb[0m: Synci[...]<jupyter_text>eval<jupyter_code>!python3 test_flow.py --modelPath $MODEL_PATH<jupyter_output>add_uniform: false
batch: 100
cond_size: 1
condition_scale: 1
dataset: MNIST
epochs: 100
eval_data:
    count: 300
flow_modules: 32-32-32-32-32
image_task: true
inputDim: 10
linear_encode: false
linear_encode_m: 50
lr: 0.001
lr_scheduler: ''
output_folder: jupyterTest
position_encode: false
position_encode_m: 50
remark: ''
sample_count: 100
start_time: _04-24_12:35
time_seed: 0
uniform_rate: 0.1
uniform_scheduler: false
var_scale: 3
workers: 8

/home/me/.local/lib/python3.7/site-packages/torchvision/datasets/mnist.py:498: UserWarning: The given NumPy array is not writeable, and PyTorch does not support non-writeable tensors. This means you can write to the underlying (supposedly non-writeable) NumPy array using the tensor. You may want to copy the array to protect its data or make it writeable before converting it to a tensor. This type of warning will be suppressed for the rest of this program. (Triggered internally at  /pytorch/torch/csrc/utils/tensor_numpy.cpp:180.)
  return torch.f[...]<jupyter_text>visualize > wiggle m = 2<jupyter_code>show()<jupyter_output><empty_output><jupyter_text>> wiggle m = 30<jupyter_code>show()<jupyter_output><empty_output><jupyter_text>> wiggle m = 100<jupyter_code>show()<jupyter_output><empty_output><jupyter_text>my_1d m = 2<jupyter_code>show()<jupyter_output><empty_output><jupyter_text>my_1d m = 30<jupyter_code>show()<jupyter_output><empty_output>
StarcoderdataJupyterStructuredCleanDedup