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/** @import { ModuleCompileOptions, ValidatedModuleCompileOptions, CompileOptions, ValidatedCompileOptions } from '#compiler' */2import * as e from './errors.js';3import * as w from './warnings.js';4 5/**6 * @template [Input=any]7 * @template [Output=Input]8 * @typedef {(input: Input, keypath: string) => Required<Output>} Validator9 */10 11const common_options = {12 filename: string('(unknown)'),13 14 // default to process.cwd() where it exists to replicate svelte4 behavior (and make Deno work with this as well)15 // see https://github.com/sveltejs/svelte/blob/b62fc8c8fd2640c9b99168f01b9d958cb2f7574f/packages/svelte/src/compiler/compile/Component.js#L21116 /* eslint-disable */17 rootDir: string(18 typeof process !== 'undefined'19 ? process.cwd?.()20 : // @ts-expect-error21 typeof Deno !== 'undefined'22 ? // @ts-expect-error23 Deno.cwd()24 : undefined25 ),26 /* eslint-enable */27 28 dev: boolean(false),29 30 generate: validator('client', (input, keypath) => {31 if (input === 'dom' || input === 'ssr') {32 warn_once(w.options_renamed_ssr_dom);33 return input === 'dom' ? 'client' : 'server';34 }35 36 // TODO deprecate `false` in favour of `analyze`/`analyzeModule` https://github.com/sveltejs/svelte-octane/issues/65537 if (input !== 'client' && input !== 'server' && input !== false) {38 throw_error(`${keypath} must be "client", "server" or false`);39 }40 41 return input;42 }),43 44 warningFilter: fun(() => true),45 46 experimental: object({47 async: boolean(false)48 })49};50 51const component_options = {52 accessors: deprecate(w.options_deprecated_accessors, boolean(false)),53 54 /** @type {Validator<'injected' | 'external' | ((options: { filename: string }) => 'injected' | 'external'), (options: { filename: string }) => 'injected' | 'external'>} */55 css: parametric(56 /** @type {(options: { filename: string }) => 'injected' | 'external'} */ (() => 'external'),57 (input) => {58 if (input === true || input === false) {59 throw_error(60 'The boolean options have been removed from the css option. Use "external" instead of false and "injected" instead of true'61 );62 }63 if (input === 'none') {64 throw_error(65 'css: "none" is no longer a valid option. If this was crucial for you, please open an issue on GitHub with your use case.'66 );67 }68 69 if (input !== 'external' && input !== 'injected') {70 throw_error(`css should be either "external" (default, recommended) or "injected"`);71 }72 73 return /** @type {'external' | 'injected'} */ (input);74 }75 ),76 77 cssHash: fun(({ css, filename, hash }) => {78 return `svelte-${hash(filename === '(unknown)' ? css : filename ?? css)}`;79 }),80 81 // TODO this is a sourcemap option, would be good to put under a sourcemap namespace82 cssOutputFilename: string(undefined),83 84 /** @type {Validator<boolean | ((options: { filename: string }) => boolean), (options: { filename: string }) => boolean>} */85 customElement: parametric(86 /** @type {(options: { filename: string }) => boolean} */ (() => false),87 (input, keypath) => {88 if (typeof input !== 'boolean') {89 throw_error(`${keypath} should be true or false`);90 }91 92 return /** @type {boolean} */ (input);93 }94 ),95 96 discloseVersion: boolean(true),97 98 immutable: deprecate(w.options_deprecated_immutable, boolean(false)),99 100 legacy: removed(101 'The legacy option has been removed. If you are using this because of legacy.componentApi, use compatibility.componentApi instead'102 ),103 104 compatibility: object({105 componentApi: list([4, 5], 5)106 }),107 108 loopGuardTimeout: warn_removed(w.options_removed_loop_guard_timeout),109 110 name: string(undefined),111 112 namespace: list(['html', 'mathml', 'svg']),113 114 modernAst: boolean(false),115 116 outputFilename: string(undefined),117 118 preserveComments: boolean(false),119 120 fragments: list(['html', 'tree']),121 122 preserveWhitespace: boolean(false),123 124 /** @type {Validator<boolean | undefined | (() => boolean | undefined), () => boolean | undefined>} */125 runes: parametric(() => /** @type {boolean | undefined} */ (undefined)),126 127 hmr: boolean(false),128 129 sourcemap: validator(undefined, (input) => {130 // Source maps can take on a variety of values, including string, JSON, map objects from magic-string and source-map,131 // so there's no good way to check type validity here132 return input;133 }),134 135 enableSourcemap: warn_removed(w.options_removed_enable_sourcemap),136 137 hydratable: warn_removed(w.options_removed_hydratable),138 139 format: removed(140 'The format option has been removed in Svelte 4, the compiler only outputs ESM now. Remove "format" from your compiler options. ' +141 'If you did not set this yourself, bump the version of your bundler plugin (vite-plugin-svelte/rollup-plugin-svelte/svelte-loader)'142 ),143 144 tag: removed(145 'The tag option has been removed in Svelte 5. Use `<svelte:options customElement="tag-name" />` inside the component instead. ' +146 'If that does not solve your use case, please open an issue on GitHub with details.'147 ),148 149 sveltePath: removed(150 'The sveltePath option has been removed in Svelte 5. ' +151 'If this option was crucial for you, please open an issue on GitHub with your use case.'152 ),153 154 // These two were primarily created for svelte-preprocess (https://github.com/sveltejs/svelte/pull/6194),155 // but with new TypeScript compilation modes strictly separating types it's not necessary anymore156 errorMode: removed(157 'The errorMode option has been removed. If you are using this through svelte-preprocess with TypeScript, ' +158 'use the https://www.typescriptlang.org/tsconfig#verbatimModuleSyntax setting instead'159 ),160 161 varsReport: removed(162 'The vars option has been removed. If you are using this through svelte-preprocess with TypeScript, ' +163 'use the https://www.typescriptlang.org/tsconfig#verbatimModuleSyntax setting instead'164 )165};166 167export const validate_module_options =168 /** @type {Validator<ModuleCompileOptions, ValidatedModuleCompileOptions>} */ (169 object({170 ...common_options,171 ...Object.fromEntries(Object.keys(component_options).map((key) => [key, () => {}]))172 })173 );174 175export const validate_component_options =176 /** @type {Validator<CompileOptions, ValidatedCompileOptions>} */ (177 object({178 ...common_options,179 ...component_options180 })181 );182 183/**184 * @param {string} msg185 * @returns {Validator}186 */187function removed(msg) {188 return (input) => {189 if (input !== undefined) {190 e.options_removed(null, msg);191 }192 return /** @type {any} */ (undefined);193 };194}195 196const warned = new Set();197 198/** @param {(node: null) => void} fn */199function warn_once(fn) {200 if (!warned.has(fn)) {201 warned.add(fn);202 fn(null);203 }204}205 206/**207 * @param {(node: null) => void} fn208 * @returns {Validator}209 */210function warn_removed(fn) {211 return (input) => {212 if (input !== undefined) warn_once(fn);213 return /** @type {any} */ (undefined);214 };215}216 217/**218 * @param {(node: null) => void} fn219 * @param {Validator} validator220 * @returns {Validator}221 */222function deprecate(fn, validator) {223 return (input, keypath) => {224 if (input !== undefined) warn_once(fn);225 return validator(input, keypath);226 };227}228 229/**230 * @param {Record<string, Validator>} children231 * @param {boolean} [allow_unknown]232 * @returns {Validator}233 */234function object(children, allow_unknown = false) {235 return (input, keypath) => {236 /** @type {Record<string, any>} */237 const output = {};238 239 if ((input && typeof input !== 'object') || Array.isArray(input)) {240 throw_error(`${keypath} should be an object`);241 }242 243 for (const key in input) {244 if (!(key in children)) {245 if (allow_unknown) {246 output[key] = input[key];247 } else {248 e.options_unrecognised(null, `${keypath ? `${keypath}.${key}` : key}`);249 }250 }251 }252 253 for (const key in children) {254 const validator = children[key];255 output[key] = validator(input && input[key], keypath ? `${keypath}.${key}` : key);256 }257 258 return output;259 };260}261 262/**263 * @param {any} fallback264 * @param {(value: any, keypath: string) => any} fn265 * @returns {Validator}266 */267function validator(fallback, fn) {268 return (input, keypath) => {269 return input === undefined ? fallback : fn(input, keypath);270 };271}272 273/**274 * @param {string | undefined} fallback275 * @param {boolean} allow_empty276 * @returns {Validator}277 */278function string(fallback, allow_empty = true) {279 return validator(fallback, (input, keypath) => {280 if (typeof input !== 'string') {281 throw_error(`${keypath} should be a string, if specified`);282 }283 284 if (!allow_empty && input === '') {285 throw_error(`${keypath} cannot be empty`);286 }287 288 return input;289 });290}291 292/**293 * @param {boolean | undefined} fallback294 * @returns {Validator}295 */296function boolean(fallback) {297 return validator(fallback, (input, keypath) => {298 if (typeof input !== 'boolean') {299 throw_error(`${keypath} should be true or false, if specified`);300 }301 return input;302 });303}304 305/**306 * @param {Array<boolean | string | number>} options307 * @returns {Validator}308 */309function list(options, fallback = options[0]) {310 return validator(fallback, (input, keypath) => {311 if (!options.includes(input)) {312 // prettier-ignore313 const msg = options.length > 2314 ? `${keypath} should be one of ${options.slice(0, -1).map(input => `"${input}"`).join(', ')} or "${options[options.length - 1]}"`315 : `${keypath} should be either "${options[0]}" or "${options[1]}"`;316 317 throw_error(msg);318 }319 return input;320 });321}322 323/**324 * @param {(...args: any) => any} fallback325 * @returns {Validator}326 */327function fun(fallback) {328 return validator(fallback, (input, keypath) => {329 if (typeof input !== 'function') {330 throw_error(`${keypath} should be a function, if specified`);331 }332 return input;333 });334}335 336/**337 * @template {(...args: any[]) => any} F338 * @param {F} fallback339 * @param {(value: unknown, keypath: string) => ReturnType<F>} [normalize]340 * @returns {Validator}341 */342function parametric(fallback, normalize = (value) => /** @type {ReturnType<F>} */ (value)) {343 return validator(fallback, (input, keypath) => {344 if (typeof input === 'function') {345 /** @type {(...args: Parameters<F>) => ReturnType<F>} */346 const normalized = (...args) => normalize(input(...args), keypath);347 348 return /** @type {F} */ (/** @type {unknown} */ (normalized));349 }350 351 /** @type {(...args: Parameters<F>) => ReturnType<F>} */352 const normalized = (..._args) => normalize(input, keypath);353 354 return /** @type {F} */ (/** @type {unknown} */ (normalized));355 });356}357 358/** @param {string} msg */359function throw_error(msg) {360 e.options_invalid_value(null, msg);361}362 