Skip to content

Instantly share code, notes, and snippets.

View ksopyla's full-sized avatar

Krzysztof Sopyła ksopyla

View GitHub Profile
@ksopyla
ksopyla / install_cuda_12_ubuntu_22.04.md
Last active November 15, 2024 10:27
How to install CUDA toolkit 12 on ubuntu 22.04, step by step guide

Step by step instruction how to install CUDA 12 Ubuntu 22.04

Clean all previous nvidia packages [optional step]

sudo apt purge nvidia*
sudo apt remove nvidia-*
sudo rm /etc/apt/sources.list.d/cuda*
@ksopyla
ksopyla / install_cuda_11_ubuntu_2004.md
Last active October 16, 2024 07:58
How to install CUDA toolkit 11 at ubuntu 20.04

Step by step instruction how to install CUDA 11 Ubuntu 20.04

NVidia Ubuntu 20.04 repository for CUDA 11

If you need CUDA Tolkit 11 with nvcc, other tools and libraries you can install it from NVIDIA Ubunutu 20.04 repository.

Add Ubuntu 20.04 repository

@ksopyla
ksopyla / polish_sentence_nltk_tokenizer.py
Last active September 28, 2024 13:09
A curated list of Polish abbreviations for NLTK sentence tokenizer based on Wikipedia text
import nltk
# interactive download
# nltk.download()
nltk.download('punkt')
extra_abbreviations = [
"ps",
"inc",
"corp",
@ksopyla
ksopyla / install_nvidia_cuda_ubuntu18.sh
Last active August 10, 2023 08:05
NVidia Cuda installation for Ubuntu 18.04. Tested with CUDA 10.1, 10.2, 11.1
#!/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 / .zshrc
Created June 9, 2023 09:21
MacOs iterm2 zshrc configuration with pyenv, poetry, colorls, powerlevel10k, autosuggestions, syntax highlighting for Python development.
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
@ksopyla
ksopyla / Fraud_Detection_Example.ipynb
Created December 23, 2022 16:16 — forked from wphicks/Fraud_Detection_Example.ipynb
Notebook example for fraud detection with the Triton FIL Backend
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ksopyla
ksopyla / ubuntu16_tensorflow_cuda8.sh
Last active March 7, 2021 16:31
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/
# 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 / polish_letters.py
Created January 4, 2021 14:14
Polish letters and characters
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 November 13, 2020 11:03
Flair loading polish embeddings
#%%
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 August 8, 2020 11:11
Pure python char ngram tokenizers: sequence and generators
#%%
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"