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 | |
| def round_away(x): | |
| return np.sign(x) * np.floor(np.abs(x) + 0.5) | |
| def quantize_affine(x, num_bits=8): | |
| x = np.asarray(x, dtype=np.float64) | |
| q_min = -(2 ** (num_bits - 1)) | |
| q_max = 2 ** (num_bits - 1) - 1 |
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 vllm import LLM, SamplingParams | |
| # Model configuration | |
| MODEL_NAME = "Qwen/Qwen2.5-0.5B-Instruct" | |
| llm = LLM(model=MODEL_NAME) | |
| # Inference configuration | |
| llm_config = { | |
| "temperature": 0.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
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| x = np.array([0, 1, 2, 3, 4, 5], dtype=float) | |
| y = np.array([1, 3, 5, 7, 9, 11], dtype=float) | |
| m = 0.0 | |
| b = 0.0 | |
| learning_rate = 0.01 |
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 { open, readFile } from "node:fs/promises"; | |
| async function* createBody() { | |
| yield Buffer.from("Hello"); | |
| yield Buffer.from(" "); | |
| yield Buffer.from("World!"); | |
| } | |
| async function writeObject(body) { | |
| const handle = await open("example.txt", "w"); |
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
| #include <array> | |
| #include <cstddef> | |
| #include <iostream> | |
| #include <optional> | |
| template <class T, std::size_t N> | |
| class RingBuffer { | |
| static_assert(N > 0, "N must be > 0"); | |
| public: |