More Keras back-compatibility fixes

This commit is contained in:
Fabio Manganiello 2020-10-28 19:46:20 +01:00
parent 870f7ad6b4
commit 604c315b5e

View file

@ -2,8 +2,8 @@ import json
import os import os
import numpy as np import numpy as np
from typing import List, Optional, Union from typing import List, Optional
from keras import Sequential, losses, optimizers, metrics from keras import Sequential
from keras.layers import Layer from keras.layers import Layer
from keras.models import load_model, Model as _Model from keras.models import load_model, Model as _Model
@ -17,9 +17,10 @@ class Model:
# noinspection PyShadowingNames # noinspection PyShadowingNames
def __init__(self, layers: Optional[List[Layer]] = None, labels: Optional[List[str]] = None, def __init__(self, layers: Optional[List[Layer]] = None, labels: Optional[List[str]] = None,
model: Optional[_Model] = None, optimizer: Union[str, optimizers.Optimizer] = 'adam', model: Optional[_Model] = None,
loss: str = 'sparse_categorical_crossentropy', optimizer='adam',
metrics: List[Union[str, metrics.Metric]] = ('accuracy',), loss='sparse_categorical_crossentropy',
metrics=('accuracy',),
low_freq: int = AudioSegment.default_low_freq, low_freq: int = AudioSegment.default_low_freq,
high_freq: int = AudioSegment.default_high_freq): high_freq: int = AudioSegment.default_high_freq):
assert layers or model assert layers or model