Skip to content

Instantly share code, notes, and snippets.

View paluchasz's full-sized avatar

Szymon Palucha paluchasz

  • Cambridge, UK
View GitHub Profile
@paluchasz
paluchasz / test_faking_redis.py
Last active December 26, 2019 18:52
Faking a Redis Connection
import json
from pathlib import Path
import pytest
from birdisle import redis
TEST_ROOT = Path(__file__).resolve().parent
rc = None
redis_key_format = "key:{i}"
@paluchasz
paluchasz / test_faking_postgres.py
Last active December 28, 2019 14:33
Faking a PostgreSQL connection
import json
from pathlib import Path
import pgdb
import pytest
import pytest_check as check
import testing.postgresql
import pandas as pd
from sqlalchemy import create_engine
@paluchasz
paluchasz / annotated_clip_attention.py
Created February 18, 2024 18:10
Annotated annotation module for CLIP
""" Annotated code for Transformers' CLIP implementation """
from typing import Optional, Tuple
import torch
from torch import nn
class CLIPAttention(nn.Module):
"""Multi-headed attention from 'Attention Is All You Need' paper"""