교 향
Maximalism
교 향
전체 방문자
오늘
어제
  • 전체글
    • Coding
    • Linux
    • Docker
    • Python
    • AI
      • GPT
      • Pandas
      • Numpy
      • tensorflow
      • pytorch
      • openCV
      • Study
      • AIconnect - [GPT]한국어..
    • Data structure, OS
    • Competitions
    • Investment
    • Book
    • Health
    • Trip
    • Memo
    • 대학원

블로그 메뉴

  • 홈
  • 태그
  • 미디어로그
  • 위치로그
  • 방명록

공지사항

인기 글

태그

  • ActivationFunction #활성화함수 #인공지능면접
  • AI면접 #딥러닝면접 #인공지능면접 #기울기소실 #GradientVanishing

최근 댓글

최근 글

티스토리

hELLO · Designed By 정상우.
교 향
AI/tensorflow

학습 중지된 경우 이어서 하려면?

AI/tensorflow

학습 중지된 경우 이어서 하려면?

2023. 9. 19. 17:05
EPOCHS = 100

for epoch in range(EPOCHS):
    for image_batch, _ in train_ds: # _ is label
        train_step(image_batch)
    
    if (epoch + 1) % 15 == 0:
    
        checkpoint.save(file_prefix=checkpoint_prefix)
        
        generate_and_save_images(generator, epoch + 1, seed)

checkpoint.save를 하도록 설정해 두었다면

컴퓨터가 다운되거나 학습이 중지되었어도

 

아래와 같이 체크포인트 가중치를 불러와서,

# 체크포인트 불러오기
checkpoint.restore(tf.train.latest_checkpoint(checkpoint_dir))

# 멈춘 부분부터 다시 실행
EPOCHS = 100

for epoch in range(EPOCHS):
    for image_batch, _ in train_ds: # _ is label
        train_step(image_batch)
    
    if (epoch + 1) % 15 == 0:
        checkpoint.save(file_prefix=checkpoint_prefix)
        generate_and_save_images(generator, epoch + 1, seed)


checkpoint.restore(tf.train.latest_checkpoint(checkpoint_dir))를 통해

 

후에 훈련을 재개할 때 이전에 멈춘 시점(epoch)부터 다시 훈련이 진행되게 할 수 있음.

'AI > tensorflow' 카테고리의 다른 글

[Tensorflow] EfficientNet 예제  (0) 2023.02.14
[keras] predict_on_batch 와 predict의 차이 ?  (0) 2023.02.01
AttributeError: 'Functional' object has no attribute 'predict_proba'  (0) 2023.01.27
[tf.data] data transform하여 dataset 추가하기  (0) 2022.12.22
자주 사용하는 Tensor함수 정리  (0) 2022.12.22
    'AI/tensorflow' 카테고리의 다른 글
    • [Tensorflow] EfficientNet 예제
    • [keras] predict_on_batch 와 predict의 차이 ?
    • AttributeError: 'Functional' object has no attribute 'predict_proba'
    • [tf.data] data transform하여 dataset 추가하기
    교 향
    교 향
    AI/ML/DL

    티스토리툴바

    개인정보

    • 티스토리 홈
    • 포럼
    • 로그인

    단축키

    내 블로그

    내 블로그 - 관리자 홈 전환
    Q
    Q
    새 글 쓰기
    W
    W

    블로그 게시글

    글 수정 (권한 있는 경우)
    E
    E
    댓글 영역으로 이동
    C
    C

    모든 영역

    이 페이지의 URL 복사
    S
    S
    맨 위로 이동
    T
    T
    티스토리 홈 이동
    H
    H
    단축키 안내
    Shift + /
    ⇧ + /

    * 단축키는 한글/영문 대소문자로 이용 가능하며, 티스토리 기본 도메인에서만 동작합니다.