<jupyter_start><jupyter_text>This script is by JBX2010 Please click "COPY to Drive" on top and save as your own copy first. Please also download the required Config files from Github. https://github.com/JBX2010/KataGo_Colab/ 1. Please first check what GPU is allocated by Colab by clicking the command line below.<jupyter_code>!nvidia-smi<jupyter_output><empty_output><jupyter_text>2. Building KataGo and gtp2ogs. Please switch CUDA/OPENCL depending on the GPU allocated. Search KATAGO_BACKEND = "OPENCL" and update accordingly. For T4 recommend to use CUDA. For P100, P4 and K80 recommend to use OPENCL.<jupyter_code>KATAGO_BACKEND="OPENCL"
%cd /content
!apt install sudo
!sudo apt remove cmake
!sudo apt purge --auto-remove cmake
!mkdir ~/temp
%cd ~/temp
!wget https://cmake.org/files/v3.12/cmake-3.12.3-Linux-x86_64.sh
!sudo mkdir /opt/cmake
!sudo sh cmake-3.12.3-Linux-x86_64.sh --prefix=/opt/cmake --skip-license
!sudo rm -R /usr/local/bin/cmake
!sudo ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake
%cd /content
!apt-get update
!add-apt-repository -y ppa:ubuntu-toolchain-r/test
!apt-get -y install gcc-8 g++-8 zlib1g-dev libzip-dev libboost-filesystem-dev libgoogle-perftools-dev
!update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 40 --slave /usr/bin/g++ g++ /usr/bin/g++-8 
!apt-get install curl
!curl -sL https://deb.nodesource.com/setup_13.x |  -E bash -
!apt-get install -y nodejs
!npm install -g gtp2ogs
%cd /content
!mkdir testtt 
%cd /content/testtt
!git clone -b devel https://github.com/online-go/gtp2ogs 
%cd /content/testtt/gtp2ogs 
!git branch 
!sudo cp -rf * /usr/lib/node_modules/gtp2ogs/
%cd /usr/lib/node_modules/gtp2ogs/ 
!npm install
%cd /content
!git clone https://github.com/lightvector/KataGo.git 
!cd /content/KataGo/cpp/ && cmake . -DBUILD_MCTS=1 -DUSE_BACKEND=$KATAGO_BACKEND && make 
!cd /content/KataGo/cpp/ && wget https://github.com/portkata/KataGo/releases/download/v0.1/60.bin.gz
!cd /content/KataGo/cpp/ && gunzip 60.bin.gz
!cd /content/KataGo/cpp/ && mv 60.bin 60e.bin
!cd /content/KataGo/cpp/ && wget http://res.yikeweiqi.com/yklinker/yk-linker.zip
!cd /content/KataGo/cpp/ && unzip yk-linker.zip<jupyter_output><empty_output><jupyter_text>3. a Run Bot on OGS https://online-go.com/ . Please update your ogsBotName and your ogsBotAPIKey in below command. Please download config file 'gtp_example.cfg' from github and upload to /KataGo/cpp/ folder first. Click the folder icon on left side to upload. Finally click command below to start you bot. You will need to logon to https://online-go.com/ with your local pc or smart phone to see how your bot runs... Enjoy!<jupyter_code>!nodejs /usr/lib/node_modules/gtp2ogs/gtp2ogs.js --username <ogsBotName> --apikey <ogsBotApikey> --ogspv KataGo  --persist   --maxconnectedgames 8  --noautohandicapranked --maxhandicap 1 --speeds live --greeting "Run a bot like this is easy. You are just a few clicks away. Have fun! https://github.com/JBX2010/KataGo_Colab/"  -- /content/KataGo/cpp/katago gtp -model /content/KataGo/cpp/60e.bin -config /content/KataGo/cpp/gtp_example.cfg<jupyter_output><empty_output><jupyter_text>3. b Run Bot on https://home.yikeweiqi.com/. Please download config.json from github and update with your https://home.yikeweiqi.com/ account name and password and then upload to folder /KataGo/cpp/yk-linker/ first.Click the folder icon on left side to upload. Finally click command below to start you bot. You will need to logon to https://home.yikeweiqi.com/ with your local pc or smart phone to see how your bot runs... Enjoy!<jupyter_code>!cd /content/KataGo/cpp/yk-linker/ && ./run_linux.sh<jupyter_output><empty_output><jupyter_text>4. (Optional) Upload pre-tuned P100 OPENCL tunning file can save sometime on the KataGo initialization and may help enhance Bot Strength (IF GPU is P100). File name: tune6_gpuTeslaP100PCIE16GB_x19_y19_c256_mv8.txt . Please upload to the same /KataGo/cpp folder and then click below command.<jupyter_code>%cd /root/
!mkdir .katago 
%cd /root/.katago/ 
!mkdir opencltuning
!mv /content/KataGo/cpp/tune6_gpuTeslaP100PCIE16GB_x19_y19_c256_mv8.txt  /root/.katago/opencltuning/tune6_gpuTeslaP100PCIE16GB_x19_y19_c256_mv8.txt<jupyter_output><empty_output><jupyter_text>5. (Optional) KataGo GPU BenchMark testing and Configuration fine tunning<jupyter_code>!cd /content/KataGo/cpp/ && ./katago benchmark  -v 3200 -tune -model 40e.bin -config gtp_example.cfg<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11760722347629797, 'fraction_numerical': 0.029345372460496615, 'mean_word_length': 4.30023923444976, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 27, 'https://': 12, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '242043', 'license': 'MIT', 'n_tokens_mistral': 1739, 'n_tokens_neox': 1628, 'n_words': 451, 'path': 'Copy_of_KataGo_on_Colab.ipynb', 'repo_name': 'portkata/KataGo', 'size': '4430'}