Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Conditional Diffusion
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Model registry
Monitor
Service Desk
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Diffusion Project
Conditional Diffusion
Commits
a186748b
Commit
a186748b
authored
1 year ago
by
Gonzalo Martin Garcia
Browse files
Options
Downloads
Patches
Plain Diff
missing dataloader in main
parent
c71c8a35
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
evaluation/sample.py
+1
-1
1 addition, 1 deletion
evaluation/sample.py
main.py
+8
-1
8 additions, 1 deletion
main.py
with
9 additions
and
2 deletions
evaluation/sample.py
+
1
−
1
View file @
a186748b
...
@@ -3,7 +3,7 @@ import torch
...
@@ -3,7 +3,7 @@ import torch
from
torchvision
import
transforms
from
torchvision
import
transforms
import
re
import
re
def
cdm_sampler
(
model
,
checkpoint
,
experiment_path
,
device
,
intermediate
=
False
,
batch_size
=
15
,
sample_all
=
False
,
n_times
=
1
):
def
cdm_sampler
(
model
,
checkpoint
,
experiment_path
,
dataloader
,
device
,
intermediate
=
False
,
batch_size
=
15
,
sample_all
=
False
,
n_times
=
1
):
'''
'''
Samples a tensor of
'
batch_size
'
images from a trained diffusion model with
'
checkpoint
'
. The generated
Samples a tensor of
'
batch_size
'
images from a trained diffusion model with
'
checkpoint
'
. The generated
images are stored in the directory
'
experiment_path/samples/epoch_{e}/sample_{j}. Where e is the epoch
images are stored in the directory
'
experiment_path/samples/epoch_{e}/sample_{j}. Where e is the epoch
...
...
This diff is collapsed.
Click to expand it.
main.py
+
8
−
1
View file @
a186748b
...
@@ -75,6 +75,13 @@ def sample_func(f):
...
@@ -75,6 +75,13 @@ def sample_func(f):
with
open
(
f
+
"
/sampling_setting.json
"
,
"
r
"
)
as
fp
:
with
open
(
f
+
"
/sampling_setting.json
"
,
"
r
"
)
as
fp
:
sampling_setting
=
json
.
load
(
fp
)
sampling_setting
=
json
.
load
(
fp
)
with
open
(
f
+
"
/dataset_setting.json
"
,
"
r
"
)
as
fp
:
dataset_setting
=
json
.
load
(
fp
)
batchsize
=
sampling_setting
[
"
batch_size
"
]
test_dataset
=
globals
()[
meta_setting
[
"
dataset
"
]](
train
=
False
,
**
dataset_setting
)
test_dataloader
=
torch
.
utils
.
data
.
DataLoader
(
test_dataset
,
batch_size
=
batchsize
,
shuffle
=
True
)
# init Unet
# init Unet
net
=
globals
()[
meta_setting
[
"
modelname
"
]](
**
model_setting
).
to
(
device
)
net
=
globals
()[
meta_setting
[
"
modelname
"
]](
**
model_setting
).
to
(
device
)
#net = torch.compile(net)
#net = torch.compile(net)
...
@@ -88,7 +95,7 @@ def sample_func(f):
...
@@ -88,7 +95,7 @@ def sample_func(f):
print
(
f
"
SAMPLING SETTINGS:
\n\n
{
sampling_setting
}
\n\n
"
)
print
(
f
"
SAMPLING SETTINGS:
\n\n
{
sampling_setting
}
\n\n
"
)
print
(
"
\n\n
START SAMPLING
\n\n
"
)
print
(
"
\n\n
START SAMPLING
\n\n
"
)
globals
()[
meta_setting
[
"
sampling_function
"
]](
model
=
framework
,
device
=
device
,
**
sampling_setting
,)
globals
()[
meta_setting
[
"
sampling_function
"
]](
model
=
framework
,
device
=
device
,
dataloader
=
test_dataloader
,
**
sampling_setting
,)
print
(
"
\n\n
FINISHED SAMPLING
\n\n
"
)
print
(
"
\n\n
FINISHED SAMPLING
\n\n
"
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment