Skip to content

Instantly share code, notes, and snippets.

View CoffeeVampir3's full-sized avatar

Z CoffeeVampir3

View GitHub Profile
@CoffeeVampir3
CoffeeVampir3 / sadadjnsauhd897uashd98sahd9a897udshq.ts
Created April 29, 2025 03:45
wefjuejwuiofwjeuifchwie9ofh8i0923hf89023hf892h89fh298fh289f3h892hf.ts
import { StreamingWebSocket, CancellationError } from "./streamingWebSocket.ts";
/**
* Example of client-side streaming inference implementation
* Following the exact flow described in the specification
*/
async function streamInference(
socket: StreamingWebSocket,
onContent: (content: string) => void
): Promise<void> {
@CoffeeVampir3
CoffeeVampir3 / Router.ts
Created April 23, 2025 04:32
router thing
import {
InferenceJobArguments,
InferenceProcessor,
} from "../frontend/InferenceProcessor.ts";
import { ClientStream } from "../router/clientStream.ts";
import { delay } from "https://deno.land/[email protected]/async/delay.ts";
import { StreamingState } from "./types.ts";
interface StreamingJob {
id: string;
#ifndef RULE_STREAM_HPP
#define RULE_STREAM_HPP
#include <multisampler.hpp>
#include <slot.hpp>
#include "llama.h"
#include "sampling.h"
#include <unordered_map>
#include <utility>
@CoffeeVampir3
CoffeeVampir3 / log.ixx
Created January 20, 2025 10:50
Logging
export module Logging;
import std;
/*
Works exactly like std::print. Fail and ass will show verbose logging data (failure location.)
Logging::info("hello world");
Logging::warn("{} + {}", "sweg and", 5);
Logging::fail("{} {}", "the ", " game");
Logging::ass(false == true, "False was not true"); //outputs to cerr
*/
@CoffeeVampir3
CoffeeVampir3 / quixel.js
Created September 18, 2024 02:05
quixeling
(await (async (startPage = 0, autoClearConsole = true) => {
const getCookie = (name) => {
const value = `; ${document.cookie}`;
const parts = value.split(`; ${name}=`);
if (parts.length === 2) return parts.pop().split(';').shift();
}
const callCacheApi = async (params = {}) => {
const defaultParams = {
@CoffeeVampir3
CoffeeVampir3 / Vulkan.cc
Last active August 22, 2024 11:30
CPP Module Example
export module Vulkan;
import <stdexcept>;
import Validation;
#define GLFW_INCLUDE_VULKAN
#include <GLFW/glfw3.h>
export namespace Vulkan {
auto CreateInstance() {
VkInstance instance;
export module VulkanInstance;
#define GLFW_INCLUDE_VULKAN
#include <GLFW/glfw3.h>
import VulkanValidation;
export namespace Vulkan {
auto CreateInstance() {
VkInstance instance;
@CoffeeVampir3
CoffeeVampir3 / gemma2_format.py
Last active August 10, 2024 13:05
Rolling system prompt
from exllamav2 import(
ExLlamaV2Tokenizer
)
def encode_message(tokenizer: ExLlamaV2Tokenizer, role: str, message: str) -> list:
tokens = []
start_token = tokenizer.single_id("<start_of_turn>")
end_token = tokenizer.single_id("<end_of_turn>")
tokens.append(start_token)
@CoffeeVampir3
CoffeeVampir3 / burnt_wick.rs
Last active July 22, 2024 20:53
candle model stream
use candle_transformers::models::quantized_llama as model;
use candle_transformers::generation::{LogitsProcessor, Sampling};
use candle_core::quantized::{gguf_file};
use candle_core::Tensor;
pub use candle_core::Device;
pub use tokenizers::Tokenizer;
pub struct StreamableModel {
model: model::ModelWeights,
tokenizer: tokenizers::Tokenizer,
@CoffeeVampir3
CoffeeVampir3 / train.ipynb
Last active July 9, 2024 08:14
Weird Initial Latent Issue.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.