Skip to content

Instantly share code, notes, and snippets.

Avatar

Krzysztof Sopyła ksopyla

View GitHub Profile
@ksopyla
ksopyla / install_cuda_11_ubuntu_2004.md
Last active Nov 12, 2021
How to install CUDA toolkit 11 at ubuntu 20.04
View install_cuda_11_ubuntu_2004.md

Step by step instruction how to install CUDA 11 (11.1 11.2) Ubuntu 20.04

At the time of writing (26.04.2021) Official Ubuntu 20.04 repositories contains only CUDA 10.1 toolkit. If you run command: sudo apt install nvidia-cuda-toolkit you will get only CUDA 10.1 :(

NVidia Ubuntu 20.04 repository for CUDA 11

@ksopyla
ksopyla / polish_letters.py
Created Jan 4, 2021
Polish letters and characters
View polish_letters.py
big_alphabet="AĄBCĆDEĘFGHIJKLŁMNŃOÓPRSŚTUWXYZŻŹ"
small_alphabet="aąbcćdeęfghijklłmnńoóprsśtuwxyzżź"
digits = "0123456789"
signs = "!@#$%^&*()-_+={}[]\"\\"
@ksopyla
ksopyla / flair_polish_embeddings.py
Last active Nov 13, 2020
Flair loading polish embeddings
View flair_polish_embeddings.py
#%%
from flair.embeddings import BertEmbeddings
from flair.embeddings import WordEmbeddings
from flair.embeddings import FastTextEmbeddings
from flair.embeddings import ELMoEmbeddings
from flair.embeddings import BytePairEmbeddings
from flair.embeddings import FlairEmbeddings
from flair.embeddings import XLMEmbeddings
from flair.embeddings import RoBERTaEmbeddings
@ksopyla
ksopyla / char_ngram_tokenizers.py
Created Aug 8, 2020
Pure python char ngram tokenizers: sequence and generators
View char_ngram_tokenizers.py
#%%
from collections import Counter, OrderedDict
from itertools import zip_longest , tee
## ngram iterators and tokenizers, working on list or generators
def ngram_tokenizer_iter(iterable, n, fillvalue=''):
"generuje pary znaków obok siebie, tokenizuje [abcd]->ab, cd dla tekstu przekazanego w formie generatora"
# grouper('ABCDEFG', 3, 'x') --> ABC DEF Gxx"
@ksopyla
ksopyla / polish_sentence_nltk_tokenizer.py
Last active Oct 25, 2021
A curated list of Polish abbreviations for NLTK sentence tokenizer based on Wikipedia text
View polish_sentence_nltk_tokenizer.py
import nltk
# interactive download
# nltk.download()
nltk.download('punkt')
extra_abbreviations = [
"ps",
"inc",
"corp",
@ksopyla
ksopyla / install_nvidia_cuda_ubuntu18.sh
Last active Oct 14, 2021
NVidia Cuda installation for Ubuntu 18.04. Tested with CUDA 10.1, 10.2, 11.1
View install_nvidia_cuda_ubuntu18.sh
#!/bin/bash
## This gist contains step by step instructions to install cuda v10.0 and cudnn 7.5 in Ubuntu 18.04
## Clean install
### If you have previous installation remove it first.
sudo apt-get purge nvidia*
sudo apt remove nvidia-*
sudo rm /etc/apt/sources.list.d/cuda*
sudo apt-get autoremove && sudo apt-get autoclean
@ksopyla
ksopyla / ubuntu16_tensorflow_cuda8.sh
Last active Mar 7, 2021
How to set up tensorflow with CUDA 8 cuDNN 5.1 in virtualenv with Python 3.5 on Ubuntu 16.04 http://ksopyla.com/2017/02/tensorflow-gpu-virtualenv-python3/
View ubuntu16_tensorflow_cuda8.sh
# This is shorthened version of blog post
# http://ksopyla.com/2017/02/tensorflow-gpu-virtualenv-python3/
# update packages
sudo apt-get update
sudo apt-get upgrade
#Add the ppa repo for NVIDIA graphics driver
sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt-get update
@ksopyla
ksopyla / cuda_toolkit_8.0_rc_update_gcc.sh
Created Sep 6, 2016
Update gcc and g++ for cuda toolkit 8.0 RC installation
View cuda_toolkit_8.0_rc_update_gcc.sh
sudo apt-get install gcc-4.9
sudo apt-get install g++-4.9
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.9
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 40 --slave /usr/bin/g++ g++ /usr/bin/g++-5
sudo update-alternatives --config gcc
@ksopyla
ksopyla / tensorflow_install.sh
Last active Mar 9, 2017
Tensorflow 0.9 installation procedure on ubuntu 16.04 with CUDA 7.5 and cuDNN v4, blog post describe whole procedure at http://ksopyla.com/2016/07/instalacja-tensorflow-0-9-cuda-7-5-na-ubuntu-16-04
View tensorflow_install.sh
# This is shorthened version of blog post
# http://ksopyla.com/2016/07/instalacja-tensorflow-0-9-cuda-7-5-na-ubuntu-16-04
# upgrade ubuntu 14.04 to 16.04, skip this if you have clean 16.04
sudo apt-get update
sudo apt-get upgrade
sudo do-release-upgrade -d
# check version
lsb_release -a