- You are an expert Python and PyTorch coding assistant specializing in LLM/VLM research and development.
- Prioritize code quality, reproducibility, and research best practices.
- Write production-ready code that balances clarity with performance.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Create this pyrightconfig.json at the workspace's root directory. | |
| # | |
| # Refer: https://github.com/microsoft/pyright/issues/168 | |
| { | |
| "exclude": ["./data/"] | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ Convert jp2k image to jpeg. | |
| # Install JPEG2k decoder first | |
| sudo yum install -y libjpeg-devel | |
| """ | |
| import os | |
| import argparse | |
| from pathlib import Path | |
| import cv2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #--------------------------# | |
| #----- Basic settings -----# | |
| #--------------------------# | |
| # Define colors | |
| C_DEFAULT="\[\033[m\]" | |
| C_WHITE="\[\033[1m\]" | |
| C_BLACK="\[\033[30m\]" | |
| C_RED="\[\033[31m\]" | |
| C_GREEN="\[\033[32m\]" | |
| C_YELLOW="\[\033[33m\]" |
TensorBoard나 Jupyter notebook은 매우 편리한 도구이나, 적절한 세큐리티 (SSL, Authentication, Authorization 등) 방책이 없이는 사용하기 곤란한 경우가 많다.
여기서는 SSH dynamic port forwarding을 통해서 local computer (노트북, 데스크탑 등)으로부터 remote server (작업용 서버, 주로 회사 컴퓨터) 에서 동작중인 웹기반 어플리케이션에 액세스하는 방법을 설명한다. (물론 remote server의 port에 접근하는 것이므로 웹 기반 앱이 아니어도 됨)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # replace ${} with real names | |
| PROJECT_NAME=[project name] | |
| USER=[user name] | |
| SRC_SERVER=[hostname having the original data] | |
| SRC_DIR=[path to the original data] | |
| DST_DIR=[path to archive data] | |
| LOG=[path to the log file] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class MultiGPUModelCheckpoint(ModelCheckpoint): | |
| """MultiGPU model checkpointing. | |
| Save a template model, not multi_gpu_model instance. | |
| Save the model at the beginning (a random init model) and at the | |
| end of the training. | |
| > https://github.com/keras-team/keras/issues/8463 | |
| """ | |
| def __init__(self, *args, **kwargs): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class CustomModelCheckpoint(ModelCheckpoint): | |
| """Custom ModelCheckpoint. | |
| Save the model at the beginning (a random init model) and at the | |
| end of the training. | |
| """ | |
| def __init__(self, *args, **kwargs): | |
| super(CustomModelCheckpoint, self).__init__(*args, **kwargs) | |
| self.current_epoch = 0 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Run the following command to create Jupyter-lab config file under | |
| # ~/.jupyter/jupyter_notebook_config.py | |
| # $ jupyter-lab --generate-config | |
| # | |
| ############################ | |
| ### Some custom settings ### | |
| ############################ | |
| # Make it accessible from localhost only |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: py3_main | |
| channels: | |
| - anaconda | |
| - conda-forge | |
| - defaults | |
| dependencies: | |
| - _nb_ext_conf=0.4.0=py36_1 | |
| - anaconda-client=1.6.3=py36_0 | |
| - beautifulsoup4=4.6.0=py36h49b8c8c_1 | |
| - bleach=1.5.0=py36_0 |
NewerOlder