mojokb / kubeflow-book

24 stars 26 forks source link

fashion-mnist-fairing 예제 실행 오류 문의 #3

Open nuri428 opened 3 years ago

nuri428 commented 3 years ago

예제로 있는 fashion-mnist-fairing.ipynb 파일을 실행 시키면 아래와 같은 오류가 발생 합니다.

[I 210105 19:06:39 config:134] Using preprocessor: <kubeflow.fairing.preprocessors.converted_notebook.ConvertNotebookPreprocessor object at 0x7f752045bbe0> [I 210105 19:06:39 config:136] Using builder: <kubeflow.fairing.builders.append.append.AppendBuilder object at 0x7f74800fa198> [I 210105 19:06:39 config:138] Using deployer: <kubeflow.fairing.deployers.job.job.Job object at 0x7f75203ffb70> [W 210105 19:06:39 append:50] Building image using Append builder... [I 210105 19:06:39 base:107] Creating docker context: /tmp/fairing_context_v1cjs1yb

TypeError Traceback (most recent call last)

in 43 44 ) ---> 45 fairing.config.run() 46 else: 47 remote_train = MyFashionMnist() ~/.local/lib/python3.6/site-packages/kubeflow/fairing/config.py in run(self) 138 logging.info("Using deployer: %s", deployer) 139 --> 140 builder.build() 141 pod_spec = builder.generate_pod_spec() 142 deployer.deploy(pod_spec) ~/.local/lib/python3.6/site-packages/kubeflow/fairing/builders/append/append.py in build(self) 50 logger.warning("Building image using Append builder...") 51 start = timer() ---> 52 new_img = self._build(transport, src) 53 end = timer() 54 logger.warning("Image successfully built in {}s.".format(end-start)) ~/.local/lib/python3.6/site-packages/kubeflow/fairing/builders/append/append.py in _build(self, transport, src) 64 65 def _build(self, transport, src): ---> 66 file, hash = self.preprocessor.context_tar_gz() # pylint:disable=redefined-builtin 67 self.context_file, self.context_hash = file, hash 68 self.image_tag = self.full_image_name(self.context_hash) ~/.local/lib/python3.6/site-packages/kubeflow/fairing/preprocessors/base.py in context_tar_gz(self, output_file) 106 _, output_file = tempfile.mkstemp(prefix="/tmp/fairing_context_") 107 logging.info("Creating docker context: %s", output_file) --> 108 self.input_files = self.preprocess() 109 with tarfile.open(output_file, "w:gz", dereference=True) as tar: 110 for dst, src in self.context_map().items(): ~/.local/lib/python3.6/site-packages/kubeflow/fairing/preprocessors/converted_notebook.py in preprocess(self) 119 exporter = nbconvert.PythonExporter() 120 exporter.register_preprocessor(self.notebook_preprocessor, enabled=True) --> 121 contents, _ = exporter.from_filename(self.notebook_file) 122 converted_notebook = Path(self.notebook_file).with_suffix('.py') 123 if converted_notebook.exists() and not self.overwrite: /usr/local/lib/python3.6/dist-packages/nbconvert/exporters/exporter.py in from_filename(self, filename, resources, **kw) 165 if not 'metadata' in resources or resources['metadata'] == '': 166 resources['metadata'] = ResourcesDict() --> 167 path, basename = os.path.split(filename) 168 notebook_name = os.path.splitext(basename)[0] 169 resources['metadata']['name'] = notebook_name /usr/lib/python3.6/posixpath.py in split(p) 105 """Split a pathname. Returns tuple "(head, tail)" where "tail" is 106 everything after the final slash. Either part may be empty.""" --> 107 p = os.fspath(p) 108 sep = _get_sep(p) 109 i = p.rfind(sep) + 1 TypeError: expected str, bytes or os.PathLike object, not NoneType 해당 내용에 대해서 문의 드립니다.
nuri428 commented 3 years ago

해당 내용은 제가 Jupyter Lab을 이용해서 발생한 문제네요 전처리 모듈이 JupyterLab을 통해서 ipynb 파일을 가져오지 못하고 있고 다른 방법이 없어서 코드를 일부 수정 해야합니다.

fairing.config.set_builder( 'append', image_name='fairing-job', base_image='brightfly/kubeflow-jupyter-lab:tf2.0-gpu', registry=DOCKER_REGISTRY,
push=True)

    fairing.config.set_preprocessor(name='notebook', notebook_file='test.ipynb')
    # 원래 예제 코드에서 아래에 이 코드를 추가 하면 됩니다. 
    # name :   전처리기 클래스명(주피터 노트북일 경우 notebook)
    # notebook_file : ipynb 파일명

    # cpu 2, memory 5GiB
    fairing.config.set_deployer('job',
                                namespace='dudaji',
                                pod_spec_mutators=[
                                    k8s_utils.get_resource_mutator(cpu=2,
                                                                   memory=5)]

                               )