This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from cython cimport Py_ssize_t | |
| from libc.stdint cimport ( | |
| uint8_t, | |
| uint16_t, | |
| uint32_t, | |
| uint64_t, | |
| ) | |
| def read_float_with_byteswap(bytes data, Py_ssize_t offset, bint byteswap): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import atexit | |
| import base64 | |
| import logging | |
| import os | |
| import pickle | |
| import diskcache | |
| import proxy2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def pack(arr): | |
| """Pack integers < 2**12 into 12 bit integers, encoded as bytes""" | |
| out = [] | |
| for i in range(0, len(arr), 2): | |
| e1, e2 = arr[i:i+2] | |
| assert 0 <= e1 < 2**12 | |
| assert 0 <= e2 < 2**12 | |
| e1 = (e1 << 4) | (e2 >> 8) | |
| e2 &= 2**8-1 | |
| assert e1 <= 2**16-1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class CompilerLauncherMixin: | |
| """Add "compiler launchers" to distutils. | |
| We use this to be able to run the Pandas build using "ccache". | |
| A compiler launcher is a program that is invoked instead of invoking the | |
| compiler directly. It is passed the full compiler invocation command line. | |
| A similar feature exists in CMake, see | |
| https://cmake.org/cmake/help/latest/prop_tgt/LANG_COMPILER_LAUNCHER.html. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def snowflake_fix_fetch( | |
| df, | |
| *, | |
| parse_variant_columns=(), | |
| lower_column_names=True, | |
| convert_int64=True, | |
| ): | |
| """Apply Snowflake-specific fixes to a dataframe fetched from Snowflake. | |
| - Lower all column names | |
| - Parse VARIANT columns |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from pyspark.sql import SparkSession | |
| def local_pyspark_cluster(n_cpus=1, memory_mb=512) -> SparkSession: | |
| """Start a local PySpark cluster with default settings. | |
| Returns a client to that session. | |
| """ | |
| return ( | |
| SparkSession.builder.master(f"local[{n_cpus}]") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pytest | |
| def mark_fixture(mark, *args, **kwargs): | |
| """Decorator to mark a fixture. | |
| Usage: | |
| @mark_fixture(pytest.mark.slow, scope="session", ...) | |
| def my_fixture(): | |
| ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import torch | |
| from torch.nn import * | |
| def pointwise(in_channels, out_channels): | |
| return Sequential( | |
| Conv2d(in_channels, out_channels, 1, 1), | |
| BatchNorm2d(out_channels), | |
| ReLU(), | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| hop | dev | dtype | win | impl | error (dB) | |
|---|---|---|---|---|---|---|
| 32 | cuda | torch.float32 | ones | torch.stft | 92 | |
| 32 | cuda | torch.float32 | ones | stft_fb | 30 | |
| 32 | cuda | torch.float32 | ones | torch_stft_fb | 92 | |
| 32 | cuda | torch.float32 | ones | librosa | 92 | |
| 32 | cuda | torch.float32 | librosa | torch.stft | 92 | |
| 32 | cuda | torch.float32 | librosa | stft_fb | 29 | |
| 32 | cuda | torch.float32 | librosa | torch_stft_fb | 92 | |
| 32 | cuda | torch.float32 | librosa | librosa | 92 | |
| 32 | cuda | torch.float32 | asteroid | torch.stft | 92 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import json | |
| import os | |
| import requests | |
| from collections import Counter | |
| username = "jonashaag" | |
| password = "..." | |
| cache_name = f"involves-{username}.json" | |
| if not os.path.exists(cache_name): |