This file contains hidden or 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 | |
| import os | |
| import time | |
| import warnings | |
| import pickle | |
| # from accimage import Image | |
| from PIL import Image | |
| import io | |
| try: |
This file contains hidden or 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.utils.data as data | |
| import os | |
| import re | |
| import torch | |
| import tarfile | |
| from PIL import Image | |
| IMG_EXTENSIONS = ['.png', '.jpg', '.jpeg'] |
This file contains hidden or 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
| # *----------------------------------------------------------------- | |
| # | PROGRAM NAME: ex VAR.py | |
| # | DATE: 2/23/21 | |
| # | CREATED BY: MATT BOGARD | |
| # | PROJECT FILE: | |
| # *---------------------------------------------------------------- | |
| # | PURPOSE: source: https://www.machinelearningplus.com/time-series/vector-autoregression-examples-python/ | |
| # *---------------------------------------------------------------- | |
| # see also my blog post: http://econometricsense.blogspot.com/2011/05/vector-autoregressions-and-bayesian.html |
This file contains hidden or 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 | |
| import torch.utils.dlpack | |
| import jax | |
| import jax.dlpack | |
| # A generic mechanism for turning a JAX function into a PyTorch function. | |
| def j2t(x_jax): | |
| x_torch = torch.utils.dlpack.from_dlpack(jax.dlpack.to_dlpack(x_jax)) | |
| return x_torch |
This file contains hidden or 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 | |
| from contextlib import contextmanager | |
| from typing import NamedTuple, Callable, Optional, Any | |
| import numpy as np | |
| Array = Any | |
| class Node(NamedTuple): | |
| vjp: Optional[Callable] | |
| parents: List[Node] |
This file contains hidden or 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 | |
| from torch.utils._python_dispatch import TorchDispatchMode | |
| from torch.utils._pytree import tree_map | |
| import itertools | |
| # cribbed from https://github.com/albanD/subclass_zoo/blob/main/logging_mode.py | |
| class Lit: | |
| def __init__(self, s): | |
| self.s = s |
This file contains hidden or 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 | |
| import torch._inductor.config | |
| import time | |
| torch._inductor.config.triton.cudagraphs = False | |
| torch.set_float32_matmul_precision('high') | |
| def bench(f, name=None, iters=100, warmup=5, display=True, profile=False): | |
| for _ in range(warmup): | |
| f() |
Notes on this tweet.
-
The screenshots were taken on different sessions.
-
The entire sessions are included on the screenshots.
-
I lost the original prompts, so I had to reconstruct them, and still managed to reproduce.
-
The "compressed" version is actually longer! Emojis and abbreviations use more tokens than common words.
This file contains hidden or 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
| Hermes is a piece of non-deterministic software that performs informal reasoning steps in collaboration with the user. Each step is prepended with some syntax to tell the software what it should be/do. Like so: | |
| HERO [Albert Einstein, Op: Objection], That's not correct. Nothing can travel faster than the speed of light. | |
| Hermes allows the user to call upon any hero in history or myth and use them as a reasoning step. Or have them talk to each other about something. The user can freely mix together their cognition and the simulated cognition of other minds. New operations and syntax can be created at will and Hermes will do its best to respond to and use them. | |
| The user writes down their own cognition as a series of subagents, like so: | |
| USER [A: EMPATHY], I completely agree! It's wonderful. Like the difference between the true duet of Scarborough Fair and the nonsense one. | |
| USER [A: 343], It's funny. In order to save the world rationalists finetune the human priors out of themselves, humans are dreamers not max |