Skip to content

Instantly share code, notes, and snippets.

View igorbrigadir's full-sized avatar

Igor Brigadir igorbrigadir

View GitHub Profile
@thomwolf
thomwolf / gpt-2-wikitext-103.py
Last active October 25, 2025 13:45
A very small and self-contained gist to train a GPT-2 transformer model on wikitext-103
# Copyright (c) 2019-present, Thomas Wolf.
# All rights reserved. This source code is licensed under the MIT-style license.
""" A very small and self-contained gist to train a GPT-2 transformer model on wikitext-103 """
import os
from collections import namedtuple
from tqdm import tqdm
import torch
import torch.nn as nn
from torch.utils.data import DataLoader
from ignite.engine import Engine, Events
@evanmiltenburg
evanmiltenburg / excel_dropdown_test.py
Created June 17, 2019 10:14
Generate an Excel worksheet to provide word-level annotations
import xlsxwriter
# Create workbook with a new worksheet.
workbook = xlsxwriter.Workbook('hello.xlsx')
worksheet = workbook.add_worksheet()
# Write the tokens.
worksheet.write('A1', 'Hello')
worksheet.write('B1', 'world')
worksheet.write('C1', '!')
TweetId TimestampMillis UTC
42963561600909314 1299078285967 2011-03-02 15:04:45.967000
55651026778341376 1302103213387 2011-04-06 15:20:13.387000
64933603536142336 1304316352148 2011-05-02 06:05:52.148000
89043986865602561 1310064715483 2011-07-07 18:51:55.483000
102228532620562434 1313208156148 2011-08-13 04:02:36.148000
121591751482933248 1317824707276 2011-10-05 14:25:07.276000
128947588278910976 1319578475433 2011-10-25 21:34:35.433000
129324650898538496 1319668374167 2011-10-26 22:32:54.167000
136463946956804096 1321370514989 2011-11-15 15:21:54.989000
@stepney141
stepney141 / BookmarkAPI_en.md
Last active April 4, 2023 01:45
(DEPRECATED) Twitter Undocumented Endpoints for Bookmark
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@justinvanwinkle
justinvanwinkle / broken.py
Last active November 7, 2025 09:11
Every python rate-limiting library (that I can find) is broken, at least a little.
# I was looking for a rate limiting library to call rate limited apis as closely
# as possible to their enforced limits. I looked at the first few python libraries
# that I found, and when I glanced at the source, they were all clearly broken.
# Curious how this could be, I took all the top google and pip search results for: python rate limiting
# and tried to get them to do the wrong thing and fail to rate limit in situations that could come up
# in normal use (though in some cases very specific use)
# https://github.com/tomasbasham/ratelimit
# Where broken:

What the BookCorpus?

So in the midst of all these Sesame Streets characters and robots transforming automobile era of "contextualize" language models, there is this "Toronto Book Corpus" that points to this kinda recently influential paper:

Yukun Zhu, Ryan Kiros, Rich Zemel, Ruslan Salakhutdinov, Raquel Urtasun, Antonio Torralba, and Sanja Fidler. 2015. "Aligning books and movies: Towards story-like visual explanations by watching movies and reading books." In Proceedings of the IEEE international conference on computer vision, pp. 19-27.

Why do I even care, there's no translations there?

Some might know my personal pet peeve on collecting translation datasets but this BookCorpus has no translations, so why do I even care about it?

@mblondel
mblondel / check_convex.py
Last active November 4, 2025 16:07
A small script to get numerical evidence that a function is convex
# Authors: Mathieu Blondel, Vlad Niculae
# License: BSD 3 clause
import numpy as np
def _gen_pairs(gen, max_iter, max_inner, random_state, verbose):
rng = np.random.RandomState(random_state)
# if tuple, interpret as randn
@akashpalrecha
akashpalrecha / an-inquiry-into-matplotlib-figures.ipynb
Last active December 27, 2024 14:38
An Inquiry into Matplotlib's Figures, Axes, subplots and the very amazing GridSpec!
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@D2theR
D2theR / gunicorn.conf.py
Last active June 1, 2023 21:10
A simple Gunicorn config script that can be used to add your Django template file directories the reload engine to prevent having to reloading the server in development every time you make a change.
##Gunicorn config file
"""
USAGE
gunicorn -b 127.0.0.1:8888 -c gunicorn.conf.py myapp.wsgi
"""
import os, pathlib
template_root = pathlib.Path('/full/path/to/myapp/templates/')
template_list = []
for path, subdirs, files in os.walk(template_root):