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; |
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 VulkanInstance; | |
#define GLFW_INCLUDE_VULKAN | |
#include <GLFW/glfw3.h> | |
import VulkanValidation; | |
export namespace Vulkan { | |
auto CreateInstance() { | |
VkInstance instance; |
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 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) |
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
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, |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
NewerOlder