Skip to content

Instantly share code, notes, and snippets.

View rocke2020's full-sized avatar
🎯
Focusing

Rocke Dong rocke2020

🎯
Focusing
  • Shanghai
  • 01:34 (UTC +08:00)
View GitHub Profile
@rocke2020
rocke2020 / itera_dataloader_example.py
Created September 3, 2023 21:50 — forked from ccj5351/itera_dataloader_example.py
Modified code with the article "How to Build a Streaming DataLoader with PyTorch" at https://medium.com/speechmatics/how-to-build-a-streaming-dataloader-with-pytorch-a66dd891d9dd.
import random
from itertools import chain, cycle, islice
import torch.utils.data as data
import matplotlib.pyplot as plt
from matplotlib.patches import Rectangle
import time
import torch
import numpy as np
@rocke2020
rocke2020 / Makefile
Created June 10, 2022 07:35 — forked from pommedeterresautee/Makefile
Divide Hugging Face Transformers training times by 2 or more with dynamic padding and uniform length batching
# required by (\ SHELL COMMANDS \)
SHELL:=/bin/bash
VIRT_ENV_FOLDER = ~/.local/share/virtualenvs/xnli
SOURCE_VIRT_ENV = source $(VIRT_ENV_FOLDER)/bin/activate
.PHONY: train
train:
( \