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 inspect | |
import io | |
import sys | |
import traceback | |
import typing | |
from collections import defaultdict | |
from functools import wraps | |
from typing import (Any, Callable, Dict, List, Literal, Optional, TypeVar, | |
Union, cast) |
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
from __future__ import annotations | |
import itertools | |
import math | |
from collections.abc import Callable, Iterable, Iterator, Sequence | |
from functools import partial, reduce | |
from operator import mul | |
from types import EllipsisType | |
from typing import Generic, Type, TypeAlias, TypeVar, Union, cast, overload |
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 collections | |
import itertools | |
import math | |
from collections import abc | |
from typing import (Any, Callable, Generic, Iterable, Iterator, List, Optional, | |
TypeVar) | |
T = TypeVar("T") | |
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 json | |
import logging | |
import time | |
import urllib.request | |
from contextlib import suppress | |
from http import HTTPStatus | |
from http.server import HTTPServer, SimpleHTTPRequestHandler | |
from multiprocessing import Process | |
from typing import Any, Callable, Type | |
from unittest.mock import patch |
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 python | |
import argparse | |
import json | |
import re | |
import subprocess | |
import time | |
from datetime import datetime | |
from typing import Any, Dict, List |
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 math | |
from typing import Any, Callable, Dict, Iterator, List, Mapping, MutableMapping, Optional, Tuple, cast | |
import datasets | |
import flax | |
import jax | |
import numpy | |
import optax | |
import tqdm | |
from flax.training import train_state |
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
from typing import (Callable, Dict, Generic, Iterable, List, Protocol, Tuple, | |
TypeVar, Union) | |
T = TypeVar("T") | |
S = TypeVar("S") | |
U = TypeVar("U", contravariant=True) | |
class SupportsDunderLT(Protocol[U]): | |
def __lt__(self, __other: U) -> bool: |
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 json | |
import pickle | |
import shutil | |
import tempfile | |
from contextlib import contextmanager | |
from os import PathLike | |
from pathlib import Path | |
from typing import ( | |
Any, | |
BinaryIO, |
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 time | |
import numpy | |
def main() -> None: | |
N = 1_000_000 | |
print("[ float x float ]") | |
xs = [float(v) for v in range(N)] | |
ys = [float(v) for v in range(N)] |
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 logging | |
import time | |
from multiprocessing import Process, Queue | |
from typing import Callable, Generic, Iterator, TypeVar | |
from uuid import uuid4 | |
import fastapi | |
from pydantic import BaseModel | |
T = TypeVar("T") |
NewerOlder