Skip to content

Commit

Permalink
fix: float to int in seeding (#141)
Browse files Browse the repository at this point in the history
  • Loading branch information
hanxiao committed Aug 5, 2022
1 parent 19079ab commit a71370a
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions discoart/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,21 +53,17 @@ def load_config(
cfg.update(**user_config)

int_keys = {k for k, v in default_args.items() if isinstance(v, int)}
int_keys.union(
{
'seed',
}
)
int_keys.add('seed')

for k, v in cfg.items():
if k in int_keys and isinstance(v, float):
if k in int_keys and v is not None and not isinstance(v, int):
cfg[k] = int(v)
if k == 'width_height':
cfg[k] = [int(vv) for vv in v]

cfg.update(
**{
'seed': cfg['seed'] or random.randint(0, 2**32),
'seed': int(cfg['seed'] or random.randint(0, 2**32)),
}
)

Expand Down

0 comments on commit a71370a

Please sign in to comment.