Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
""" | |
>>> python remove_unused_bibs.py -h | |
usage: remove_unused_bibs.py [-h] [-b BIB_FILES] [-p PAPER_FILES] [-o OUT_FILE] | |
Remove unused bibtex entries | |
options: | |
-h, --help show this help message and exit | |
-b BIB_FILES, --bib_files BIB_FILES |
This file contains 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
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
"""psqueue.py | |
This script displays squeue in a pretty table. | |
""" | |
import os | |
import subprocess | |
import sys | |
try: |
This file contains 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
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
"""psinfo.py | |
This script displays sinfo in a pretty table. | |
""" | |
import platform | |
import subprocess | |
import sys | |
try: |
This file contains 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
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
"""quotacheck.py | |
This script displays user quotas for a given mount point. | |
""" | |
import os | |
import platform | |
import subprocess | |
import sys |
This file contains 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 numpy as np | |
def compute_kendall_taus(h, m): | |
""" | |
Compute multiple variants of Kendall's Tau correlations between two rank arrays. | |
This function calculates several variants of Kendall's Tau correlations (tau_a, tau_b, tau_c, | |
tau_10, tau_13, tau_14, tau_23) between two input rank arrays. It employs vectorized operations | |
for computation efficiency and can handle tied ranks. This function is an implementation based on |
This file contains 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
"""Adapted from https://github.com/bastings/interpretable_predictions""" | |
import math | |
import distrax | |
import jax | |
import jax.numpy as jnp | |
EPS = 1e-6 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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 | |
def create_bow(words, vocab_size, pad_id=None): | |
""" | |
Create a bag of words matrix using torch.sparse.FloatTensor. | |
Args: | |
words (torch.LongTensor): tensor containing ids for words in | |
your vocabulary. Shape of (batch_size, seq_len) | |
vocab_size (int): size of the words vocabulary (including special |
This file contains 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
@staticmethod | |
def select_word_pieces(features, bounds, method='first'): | |
""" | |
Args: | |
features (torch.Tensor): output of BERT. Shape of (bs, ts, h_dim) | |
bounds (torch.LongTensor): the indexes where the word pieces start. | |
Shape of (bs, ts) | |
e.g. Welcome to the jungle -> Wel_ _come _to _the _jungle | |
bounds[0] = [0, 2, 3, 4] | |
indexes for padding positions are expected to be equal to -1 |
NewerOlder