Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eliminate jsonmerge dependency #73

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions k_diffusion/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,19 @@
import math
import warnings

from jsonmerge import merge

from . import augmentation, layers, models, utils


def merge_config(defaults, config):
result = {**defaults}
for key, value in config.items():
if isinstance(value, dict):
result[key] = merge_config(result.get(key, {}), value)
else:
result[key] = value
return result


def load_config(file):
defaults = {
'model': {
Expand Down Expand Up @@ -44,7 +52,7 @@ def load_config(file):
},
}
config = json.load(file)
return merge(defaults, config)
return merge_config(defaults, config)


def make_model(config):
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ accelerate
clean-fid
clip-anytorch
einops
jsonmerge
kornia
Pillow
resize-right
Expand Down
1 change: 0 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ install_requires =
clean-fid
clip-anytorch
einops
jsonmerge
kornia
Pillow
resize-right
Expand Down