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 os | |
| import struct | |
| class PalMessages: | |
| def __init__(self, pal_path): | |
| self.pal_path = pal_path | |
| mkf_path = os.path.join(self.pal_path, 'Sss.mkf') | |
| self._index_data = self._read_mkf_subfile(mkf_path, 3) |
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 sys | |
| import re | |
| def parse_bdf_and_convert(input_file, output_file): | |
| MAX_CHARS = 65536 | |
| font_data = [[0, 0, 0, 0] for _ in range(MAX_CHARS)] | |
| font_wide = [False] * MAX_CHARS | |
| current_char = -1 | |
| in_bitmap = False | |
| bitmap_lines = [] |
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 pathlib import Path | |
| import torch | |
| import torch.nn as nn | |
| import torch.nn.functional as F | |
| from safetensors import safe_open | |
| from tokenizers import Tokenizer | |
| CFG = { | |
| "vocab_size": 262_144, | |
| "context_length": 32_768, |
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 dataclasses import dataclass | |
| from pathlib import Path | |
| import torch | |
| from torch import nn | |
| import torch.nn.functional as F | |
| from safetensors import safe_open | |
| from tokenizers import Tokenizer |
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 os | |
| from functools import lru_cache | |
| import torch | |
| from torch import nn | |
| import torch.nn.functional as F | |
| from transformers import Qwen3Config | |
| from transformers import Qwen2TokenizerFast |
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
| #!/usr/bin/env python3 | |
| # https://github.com/FateScript/experiments/blob/main/se/mpi/mpi.py | |
| # https://github.com/facebookincubator/gloo/tree/main/gloo | |
| import math | |
| import multiprocessing | |
| import os | |
| import numpy as np |
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.nn as nn | |
| import torch.nn.functional as F | |
| import torch.optim as optim | |
| import numpy as np | |
| import gym | |
| # Hyperparameters | |
| num_inputs = 4 | |
| num_actions = 2 |
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
| × / | |
| ← → ↔ ⇐ ⇒ ⇔ | |
| ⟵ ⟶ ⟷ ⟸ ⟹ ⟺ | |
| ∀ ∃ | |
| ∂ ∫ | |
| ∈ ∊ ∉ | |
| ∏ ∑ | |
| ∙ ⋅ | |
| √ | |
| ∞ |
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 | |
| class ModelArgs: | |
| dim = 288 | |
| n_layers = 6 | |
| n_heads = 6 | |
| norm_eps = 1e-6 | |
| def build_cos_sin_cache(head_dim, seq_len, base=10000): | |
| theta = 1. / (base ** (np.arange(0, head_dim, 2, dtype=np.float32) / head_dim)) |
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 | |
| N_inp = 64 | |
| N_out = 64 | |
| d = 128 | |
| Q = np.random.randn(N_out, d) | |
| K = np.random.randn(N_inp, d) | |
| V = np.random.randn(N_inp, d) | |
| O = np.random.randn(N_out, d) |
NewerOlder