Skip to content

Instantly share code, notes, and snippets.

View malteos's full-sized avatar

malteos malteos

  • Berlin, Germany
View GitHub Profile

Connect via SSH to a Slurm compute job that runs as Enroot container

Being able to SSH directly into a compute job has the advantage of using all remote development tools such as using your IDE's debugger also for GPU jobs (VSCode, PyCharm, ...).

  • Slurm: Scheduling system that many HPC clusters use
  • Enroot: Container system like Docker for NVIDIA GPUs

General problem:

#!/bin/bash
#SBATCH --job-name=oxw-bloom-1b7-twc-german
#SBATCH --ntasks-per-node=1 # crucial - only 1 task per dist per node!
#SBATCH --nodes=4
#SBATCH --gres=gpu:4 # ---> does not matter on JUWELS
#SBATCH --cpus-per-task=48 # number of cores per tasks
#SBATCH --hint=nomultithread # we get physical cores not logical
#SBATCH --time=0-12:00:00
#SBATCH --output=%j.%x.out
#SBATCH --partition=booster
@malteos
malteos / german-iso-3166.csv
Last active September 27, 2023 09:23
German ISO-3166 Country Codes CSV (deutsche Ländercodes)
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
AF Afghanistan
EG Ägypten
AL Albanien
DZ Algerien
AD Andorra
AO Angola
AI Anguilla
AQ Antarktis
AG Antigua und Barbuda
GQ Äquatorial Guinea
# Copyright 2022 EleutherAI and The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
import argparse
import os
import torch
from transformers.models.auto import AutoModelForCausalLM
LAYER_FILE_PREFIX = 'layer_'
MODEL_FILE_PREFIX = 'model_'
EMBEDDING_LAYER_INDEX = 1
@malteos
malteos / letsencrypt-ssl-dns-docker.sh
Created December 2, 2018 12:38
Obtain Lets-Encrypt SSL Certificate via Docker DNS challenge
# Obtain Lets-Encrypt SSL Certificate via Docker DNS challenge
# adjust:
# - domains (-d foo.me)
mkdir letsencrypt_etc letsencrypt_var
docker run -it --rm --name certbot \
-v "./letsencrypt_etc:/etc/letsencrypt" \
-v "./letsencrypt_var:/var/lib/letsencrypt" \
certbot/certbot certonly -d foo.me -d *.foo.me --manual --preferred-challenges dns
@malteos
malteos / Mixxx_2deck_keyboard_mapping.kbd.cfg
Created April 20, 2017 13:24
Keyboard mapping for Mixxx DJ software. High-mid-low equalizer.
[AutoDJ]
[Master]
[VinylControl]
[PreviewDeck1]
[Channel1]
play y

Returns only 'Main Page'

curl -XPOST localhost:9200/wiki_content/_search?pretty -d '
{
  "_source": [
    "title"
  ],
  "query": {
    "bool": {
      "should": [

Testing Queries for CirrusSearch extension

As produced by SimpleKeywordFeature.doApply() (boosting has no effect)

curl -XPOST localhost:9200/wiki_content/_search?pretty -d '
{
  "_source": [
    "title"
  ],
  "query": {
@malteos
malteos / auc-gammaidx.py
Last active May 23, 2016 17:17
AUC + GAMMAIDX
def auc(y_true, y_val, plot=False):
"""
Computes the AUC (area under the receiver operator curve).
For example, y val could be the output of a learning algorithm (binary logistic regression, ...).
:param y_true: true labels in {-1,+1}
:param y_val: predicted value where lower values tend to correspond to label -1 and higher values to label +1
:param plot: whether to plot the ROC curve or not
:return: returns the AUC
"""
sum_cond_pos = np.count_nonzero(y_true == 1)