ai-starthon / AI_Starthon2019

60 stars 44 forks source link

1_reg_dust, Keras 코드가 정상 동작하나요? #181

Open cycos83 opened 5 years ago

cycos83 commented 5 years ago

Informations

CLI

WEB

What is your NSML login ID?

Question 모델을 계속 바꾸고 run 상태에서 loss가 줄어드는것을 확인해도 submit을 하면 항상 1408.xxxxxx 의 스코어가 나옵니다. weight가 제대로 저장이 안되는것 같습니다

seungyuns commented 5 years ago

동일한 증상겪고있습니다...

cycos83 commented 5 years ago

이제보니 model은 매번 선언되는 내용을 그대로 이용하기 때문에 모델 자체는 저장할 필요가 없고 weight를 저장하고 로드하도록 함수들을 작성해야 하는군요(예제로 공개한 1_reg_dust의 Keras 코드 자제차 문제가 있음)

def bind_model(model):

save the model with 'checkpoint' dictionary.

def save(path, *args, **kwargs):
    model.save_weights(os.path.join(path, 'model'))
    print('model saved!')

def load(path, *args, **kwargs):
    model.load_weights(os.path.join(path, 'model'))
    print('model loaded!')

def infer(path, **kwargs):
    return inference(path, model, config)

nsml.bind(save, load, infer)

위 처럼 bind_model 함수를 수정하니 정상 동작하는 것을 확인했습니다

jungwoo-ha commented 5 years ago

@cycos83 네 감사합니다.