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 safetensors.torch import save_model, load_model | |
from safetensors import safe_open | |
import json | |
config_dict = {'version': '1.0'} | |
metadata = {k: json.dumps(v) if not isinstance(v, str) else v for k, v in config_dict.items()} | |
save_model(model, "model.safetensors", metadata=metadata) | |
# ... |
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 | |
from einops import rearrange | |
def tversky_multihead_similarity_vectorized_simple(x, features, prototypes, theta, alpha, beta, n_heads): | |
batch_size, total_dim = x.shape | |
d_head = total_dim // n_heads | |
x = rearrange(x, 'b (h d) -> b h d', h=n_heads) |
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 express from "npm:express"; | |
import { randomUUID } from "node:crypto"; | |
import { McpServer } from "npm:@modelcontextprotocol/sdk/server/mcp.js"; | |
import { StreamableHTTPServerTransport } from "npm:@modelcontextprotocol/sdk/server/streamableHttp.js"; | |
import { z } from "npm:zod"; | |
const PORT = 3000; | |
const MCP_ENDPOINT = "/mcp"; | |
const app = express(); |
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
[TOOL_CALLS][{"name": "add", "arguments": {"a": 5, "b": 3}}][/TOOL_CALLS] |
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 { 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> { |
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 { | |
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; |
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
#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> |
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
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 | |
*/ |
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
(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 = { |
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
export module Vulkan; | |
import <stdexcept>; | |
import Validation; | |
#define GLFW_INCLUDE_VULKAN | |
#include <GLFW/glfw3.h> | |
export namespace Vulkan { | |
auto CreateInstance() { | |
VkInstance instance; |
NewerOlder