Jupyter에서 실행 오류 보완, 실행 파일마다의 model 경로 다르게 #20
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
3가지 수정
Jupyter 실행 시의 오류 보완
'05 - TensorBaord, Saver'의 Saver.py를 jupyter에서 반복 실행시키면 다음의 오류가 발생합니다.
========================================================================
NotFoundError Traceback (most recent call last)
/anaconda3/envs/python3/lib/python3.6/site-packages/tensorflow/python/client/session.py in _do_call(self, fn, *args)
1326 try:
-> 1327 return fn(*args)
1328 except errors.OpError as e:
/anaconda3/envs/python3/lib/python3.6/site-packages/tensorflow/python/client/session.py in _run_fn(session, feed_dict, fetch_list, target_list, options, run_metadata)
1305 feed_dict, fetch_list, target_list,
-> 1306 status, run_metadata)
1307
/anaconda3/envs/python3/lib/python3.6/contextlib.py in exit(self, type, value, traceback)
87 try:
---> 88 next(self.gen)
89 except StopIteration:
========================================================================
발생 이유는 Jupyter에는 한번 실행 이후 프로세스가 종료되지 않고, 커널로 계속 유지됩니다. 이런 관계로 이전에 실행했던 그래프가 그대로 남아 있고, 이로 인해 오류가 발생합니다. 이를 방지 하기 위해 그래프를 구성하기 전에 tf.reset_default_graph() 를 호출하여 리셋합니다.
실행 파일 마다의 model 경로 다르게
3개의 실행 파일들의 model 저장 경로가 같아서, 서로 의존성이 있습니다. 이를 방지하기 위하여 경로를 다르게 변경했습니다.
기존 model, logs 폴더 삭제
이 폴더가 없어도 실행 시키면 생성되니까 없어도 될것 같네요. 특히 model폴더의 경우 실행 파일마다 경로를 다르게 해서 필요없어진 경우네요.