Skip to content

Instantly share code, notes, and snippets.

View justheuristic's full-sized avatar
💭
on github.com/learning-at-home

justheuristic justheuristic

💭
on github.com/learning-at-home
View GitHub Profile
@justheuristic
justheuristic / create_roll_table.py
Last active August 12, 2024 16:20
Generated with versions bokeh - 3.1.1; numpy - 1.23.5; tqdm - 4.64.1 (pip install bokeh==3.1.1 numpy tqdm)
"""
This script creates an HTML file that displays success probabilities for Changeling the Dreaming 20th Anniversary Edition.
See lines 27-34 for parameters that you might want to change. Note that large num_attempts will slow down the script.
You can run the code in a Jupyter Notebook or similar to display the roll table interactively in your notebook.
CtD20 differs from prior editions: willpower success can be cancelled by a "1" and speciality grants two successes on 10.
If you want to change how this works (e.g. VtM 3e willpower can't be cancelled), find and modify def roll_dice(...) below.
License: do whatever you want with this file, see Unlicense for details https://en.wikipedia.org/wiki/Unlicense
"""
import random
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import time
from math import isfinite
import pandas as pd
import selenium.webdriver
data = pd.read_csv('avtomaticheskaia-obrabotka-tekstov-2020-autumn - avtomaticheskaia-obrabotka-tekstov-2020-autumn.csv')
# ^-- file format: https://docs.google.com/spreadsheets/d/1GcdT7eID_wNMjjxV0v6T0kOBRHn6Bg79qO80vFY_zgg/edit#gid=781547499
assignment_title = 'Week9 - Word alignment'
# authors: jheuristic, qwicen
import torch
import torch.nn as nn
import threading
device = 'cuda' if torch.cuda.is_available() else 'cpu'
class TrainableSparseMatrix(nn.Module):
def __init__(self, indices, values, **kwargs):
"""
import torch, torch.nn as nn, torch.nn.functional as F
import numpy as np
class OneCycleSchedule:
""" A simplified torch lr schedule that updates learning rate before every opt.step """
def __init__(self, optimizer, **kwargs):
"""
:type optimizer: torch.optim.Optimizer
:param kwargs: see self.update_learning_rate
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.