Home [ETC] colab을 local에 연결하기
Post
Cancel

[ETC] colab을 local에 연결하기

document : https://research.google.com/colaboratory/local-runtimes.html

 

jupyter 설치

document : https://jupyter.org/install

1
pip install notebook

또는

1
pip install jupyterlab

notebook은 다소 예전꺼라, jupyterlab을 사용해보려고 한다.

  • 설치 확인
1
jupyter-lab

 

여기서 notebook에 있는 python을 누르게 되면, 기존의 jupyter 방식의 ipynb파일이 열린다.

 

그리고 console을 선택하면 터미널 창 형태로 python이 열린다.

 

other에 터미널을 열면 평범한 cmd창이 열린다.

 

실행시켰던 터미널에서 명령을 끄면, 서버가 닫힌다.

 

 

jupyter_http_over_ws 설치

1
pip install jupyter_http_over_ws

서버 시작 및 인증

새로운 노트 서버를 생성한다. 서버가 시작되면 인증에 사용될 초기 백엔드 URL과 함께 메세지가 출력된다.

1
2
3
4
5
6
$ jupyter-lab --allow-root --NotebookApp.allow_origin='https://colab.research.google.com' --port=8888 --NotebookApp.port_retries=0

Enabling: jupyter_http_over_ws
- Writing config: /root/.jupyter
    - Validating...
      jupyter_http_over_ws 0.0.7 OK

코랩과 서버 연결하기

연결하고자 하는 코랩 ipynb로 가서 연결 -> 로컬 런타임에 연결 하면 다음과 같은 화면이 나온다.

 

연결이 되면 연결됨(로컬)이라는 표시를 볼 수 있고, 연결이 되면 자기 컴퓨터에 있는 GPU 및 공간이 코랩에 사용되고 있는 것을 확인할 수 있다.

 

 

서버 제거

1
jupyter serverextension disable --py jupyter_http_over_ws 

 

  • 패키지 삭제
1
pip uninstall jupyter_http_over_ws
This post is licensed under CC BY 4.0 by the author.