Computer engineering/Python Error
NotImplementedError: Layer PositionalEncoding has arguments in `__init__` and therefore must override `get_config`.
불굴의관돌이
2021. 3. 6. 22:10
에러가 나오는 원인
get_config라는 함수가 없기때문.
callback 함수를 사용해 모델을 저장하려하는데 위 에러 발생
callback 함수를 사용하지 않고 model.fit을 하는 경우에는 위 에러가 발생하지 않는다.
해결 방법
model class 내에 get_config라는 함수를 만들어 주면 된다.
def get_config(self):
config=super().get_config().copy()
return config