Brunobkr/llama.cpp_AlgMor24_github
ΩFFFΣLLIa • llama.cpp • AlgMor24 ██████╗ ███████╗███████╗███████╗██╗ ██╗ ██╗ █████╗ ██╔═══██╗██╔════╝██╔════╝██╔════╝██║ ██║ ██║██╔══██╗ ██║ ██║█████╗ █████╗ █████╗ ██║ ██║ ██║███████║ ██║ ██║██╔══╝ ██╔══╝ ██╔══╝ ██║ ██║ ██║██╔══██║ ╚██████╔╝██║ ██║ ███████╗███████╗███████╗██║██║ ██║ ╚═════╝ ╚═╝ ╚═╝ ╚══════╝╚══════╝╚══════╝╚═╝╚═╝ ╚═╝ High-Performance LLM / VLM Inference & Autonomous Agentic Ecosystem… See the full description on the dataset page: https://huggingface.co/datasets/Brunobkr/llama.cpp_AlgMor24_github.
03.1k
1// @ts-ignore -- we don't include node types in the production build2/** @import { AsyncLocalStorage } from 'node:async_hooks' */3/** @import { RenderContext } from '#server' */4 5import { deferred, noop } from '../shared/utils.js';6import * as e from './errors.js';7 8/** @type {Promise<void> | null} */9let current_render = null;10 11/** @type {RenderContext | null} */12let context = null;13 14/** @returns {RenderContext} */15export function get_render_context() {16 const store = context ?? als?.getStore();17 18 if (!store) {19 e.server_context_required();20 }21 22 return store;23}24 25/**26 * @template T27 * @param {() => Promise<T>} fn28 * @returns {Promise<T>}29 */30export async function with_render_context(fn) {31 context = {32 hydratable: {33 lookup: new Map(),34 comparisons: [],35 unresolved_promises: new Map()36 }37 };38 39 if (in_webcontainer()) {40 const { promise, resolve } = deferred();41 const previous_render = current_render;42 current_render = promise;43 await previous_render;44 return fn().finally(resolve);45 }46 47 try {48 if (als === null) {49 e.async_local_storage_unavailable();50 }51 return als.run(context, fn);52 } finally {53 context = null;54 }55}56 57/** @type {AsyncLocalStorage<RenderContext | null> | null} */58let als = null;59/** @type {Promise<void> | null} */60let als_import = null;61 62/**63 *64 * @returns {Promise<void>}65 */66export function init_render_context() {67 // It's important the right side of this assignment can run a maximum of one time68 // otherwise it's possible for a very, very well-timed race condition to assign to `als`69 // at the beginning of a render, and then another render to assign to it again, which causes70 // the first render's second half to use a new instance of `als` which doesn't have its71 // context anymore.72 // @ts-ignore -- we don't include node types in the production build73 als_import ??= import('node:async_hooks')74 .then((hooks) => {75 als = new hooks.AsyncLocalStorage();76 })77 .then(noop, noop);78 return als_import;79}80 81// this has to be a function because rollup won't treeshake it if it's a constant82function in_webcontainer() {83 // @ts-ignore -- this will fail when we run typecheck because we exclude node types84 // eslint-disable-next-line n/prefer-global/process85 return !!globalThis.process?.versions?.webcontainer;86}87 