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"use strict";2var __create = Object.create;3var __defProp = Object.defineProperty;4var __getOwnPropDesc = Object.getOwnPropertyDescriptor;5var __getOwnPropNames = Object.getOwnPropertyNames;6var __getProtoOf = Object.getPrototypeOf;7var __hasOwnProp = Object.prototype.hasOwnProperty;8var __export = (target, all) => {9 for (var name in all)10 __defProp(target, name, { get: all[name], enumerable: true });11};12var __copyProps = (to, from, except, desc) => {13 if (from && typeof from === "object" || typeof from === "function") {14 for (let key of __getOwnPropNames(from))15 if (!__hasOwnProp.call(to, key) && key !== except)16 __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });17 }18 return to;19};20var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(21 // If the importer is in node compatibility mode or this is not an ESM22 // file that has been converted to a CommonJS file using a Babel-23 // compatible transform (i.e. "__esModule" has not been set), then set24 // "default" to the CommonJS "module.exports" for node compatibility.25 isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,26 mod27));28var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);29var testInfo_exports = {};30__export(testInfo_exports, {31 StepSkipError: () => StepSkipError,32 TestInfoImpl: () => TestInfoImpl,33 TestSkipError: () => TestSkipError,34 TestStepInfoImpl: () => TestStepInfoImpl35});36module.exports = __toCommonJS(testInfo_exports);37var import_fs = __toESM(require("fs"));38var import_path = __toESM(require("path"));39var import_utils = require("playwright-core/lib/utils");40var import_timeoutManager = require("./timeoutManager");41var import_util = require("../util");42var import_testTracing = require("./testTracing");43var import_util2 = require("./util");44var import_transform = require("../transform/transform");45class TestInfoImpl {46 constructor(configInternal, projectInternal, workerParams, test, retry, onStepBegin, onStepEnd, onAttach) {47 this._snapshotNames = { lastAnonymousSnapshotIndex: 0, lastNamedSnapshotIndex: {} };48 this._ariaSnapshotNames = { lastAnonymousSnapshotIndex: 0, lastNamedSnapshotIndex: {} };49 this._wasInterrupted = false;50 this._lastStepId = 0;51 this._steps = [];52 this._stepMap = /* @__PURE__ */ new Map();53 this._onDidFinishTestFunctions = [];54 this._hasNonRetriableError = false;55 this._hasUnhandledError = false;56 this._allowSkips = false;57 this.duration = 0;58 this.annotations = [];59 this.attachments = [];60 this.status = "passed";61 this.snapshotSuffix = "";62 this.errors = [];63 this.testId = test?.id ?? "";64 this._onStepBegin = onStepBegin;65 this._onStepEnd = onStepEnd;66 this._onAttach = onAttach;67 this._startTime = (0, import_utils.monotonicTime)();68 this._startWallTime = Date.now();69 this._requireFile = test?._requireFile ?? "";70 this._uniqueSymbol = Symbol("testInfoUniqueSymbol");71 this._workerParams = workerParams;72 this.repeatEachIndex = workerParams.repeatEachIndex;73 this.retry = retry;74 this.workerIndex = workerParams.workerIndex;75 this.parallelIndex = workerParams.parallelIndex;76 this._projectInternal = projectInternal;77 this.project = projectInternal.project;78 this._configInternal = configInternal;79 this.config = configInternal.config;80 this.title = test?.title ?? "";81 this.titlePath = test?.titlePath() ?? [];82 this.file = test?.location.file ?? "";83 this.line = test?.location.line ?? 0;84 this.column = test?.location.column ?? 0;85 this.tags = test?.tags ?? [];86 this.fn = test?.fn ?? (() => {87 });88 this.expectedStatus = test?.expectedStatus ?? "skipped";89 this._timeoutManager = new import_timeoutManager.TimeoutManager(this.project.timeout);90 if (configInternal.configCLIOverrides.debug)91 this._setDebugMode();92 this.outputDir = (() => {93 const relativeTestFilePath = import_path.default.relative(this.project.testDir, this._requireFile.replace(/\.(spec|test)\.(js|ts|jsx|tsx|mjs|mts|cjs|cts)$/, ""));94 const sanitizedRelativePath = relativeTestFilePath.replace(process.platform === "win32" ? new RegExp("\\\\", "g") : new RegExp("/", "g"), "-");95 const fullTitleWithoutSpec = this.titlePath.slice(1).join(" ");96 let testOutputDir = (0, import_util.trimLongString)(sanitizedRelativePath + "-" + (0, import_utils.sanitizeForFilePath)(fullTitleWithoutSpec), import_util.windowsFilesystemFriendlyLength);97 if (projectInternal.id)98 testOutputDir += "-" + (0, import_utils.sanitizeForFilePath)(projectInternal.id);99 if (this.retry)100 testOutputDir += "-retry" + this.retry;101 if (this.repeatEachIndex)102 testOutputDir += "-repeat" + this.repeatEachIndex;103 return import_path.default.join(this.project.outputDir, testOutputDir);104 })();105 this.snapshotDir = (() => {106 const relativeTestFilePath = import_path.default.relative(this.project.testDir, this._requireFile);107 return import_path.default.join(this.project.snapshotDir, relativeTestFilePath + "-snapshots");108 })();109 this._attachmentsPush = this.attachments.push.bind(this.attachments);110 this.attachments.push = (...attachments) => {111 for (const a of attachments)112 this._attach(a, this._parentStep()?.stepId);113 return this.attachments.length;114 };115 this._tracing = new import_testTracing.TestTracing(this, workerParams.artifactsDir);116 this.skip = (0, import_transform.wrapFunctionWithLocation)((location, ...args) => this._modifier("skip", location, args));117 this.fixme = (0, import_transform.wrapFunctionWithLocation)((location, ...args) => this._modifier("fixme", location, args));118 this.fail = (0, import_transform.wrapFunctionWithLocation)((location, ...args) => this._modifier("fail", location, args));119 this.slow = (0, import_transform.wrapFunctionWithLocation)((location, ...args) => this._modifier("slow", location, args));120 }121 get error() {122 return this.errors[0];123 }124 set error(e) {125 if (e === void 0)126 throw new Error("Cannot assign testInfo.error undefined value!");127 this.errors[0] = e;128 }129 get timeout() {130 return this._timeoutManager.defaultSlot().timeout;131 }132 set timeout(timeout) {133 }134 _deadlineForMatcher(timeout) {135 const startTime = (0, import_utils.monotonicTime)();136 const matcherDeadline = timeout ? startTime + timeout : import_timeoutManager.kMaxDeadline;137 const testDeadline = this._timeoutManager.currentSlotDeadline() - 250;138 const matcherMessage = `Timeout ${timeout}ms exceeded while waiting on the predicate`;139 const testMessage = `Test timeout of ${this.timeout}ms exceeded`;140 return { deadline: Math.min(testDeadline, matcherDeadline), timeoutMessage: testDeadline < matcherDeadline ? testMessage : matcherMessage };141 }142 static _defaultDeadlineForMatcher(timeout) {143 return { deadline: timeout ? (0, import_utils.monotonicTime)() + timeout : 0, timeoutMessage: `Timeout ${timeout}ms exceeded while waiting on the predicate` };144 }145 _modifier(type, location, modifierArgs) {146 if (typeof modifierArgs[1] === "function") {147 throw new Error([148 "It looks like you are calling test.skip() inside the test and pass a callback.",149 "Pass a condition instead and optional description instead:",150 `test('my test', async ({ page, isMobile }) => {`,151 ` test.skip(isMobile, 'This test is not applicable on mobile');`,152 `});`153 ].join("\n"));154 }155 if (modifierArgs.length >= 1 && !modifierArgs[0])156 return;157 const description = modifierArgs[1];158 this.annotations.push({ type, description, location });159 if (type === "slow") {160 this._timeoutManager.slow();161 } else if (type === "skip" || type === "fixme") {162 this.expectedStatus = "skipped";163 throw new TestSkipError("Test is skipped: " + (description || ""));164 } else if (type === "fail") {165 if (this.expectedStatus !== "skipped")166 this.expectedStatus = "failed";167 }168 }169 _findLastPredefinedStep(steps) {170 for (let i = steps.length - 1; i >= 0; i--) {171 const child = this._findLastPredefinedStep(steps[i].steps);172 if (child)173 return child;174 if ((steps[i].category === "hook" || steps[i].category === "fixture") && !steps[i].endWallTime)175 return steps[i];176 }177 }178 _parentStep() {179 return (0, import_utils.currentZone)().data("stepZone") ?? this._findLastPredefinedStep(this._steps);180 }181 _addStep(data, parentStep) {182 const stepId = `${data.category}@${++this._lastStepId}`;183 if (data.category === "hook" || data.category === "fixture") {184 parentStep = this._findLastPredefinedStep(this._steps);185 } else {186 if (!parentStep)187 parentStep = this._parentStep();188 }189 const filteredStack = (0, import_util.filteredStackTrace)((0, import_utils.captureRawStack)());190 let boxedStack = parentStep?.boxedStack;191 let location = data.location;192 if (!boxedStack && data.box) {193 boxedStack = filteredStack.slice(1);194 location = location || boxedStack[0];195 }196 location = location || filteredStack[0];197 const step = {198 ...data,199 stepId,200 group: parentStep?.group ?? data.group,201 boxedStack,202 location,203 steps: [],204 attachmentIndices: [],205 info: new TestStepInfoImpl(this, stepId, data.title, parentStep?.info),206 complete: (result) => {207 if (step.endWallTime)208 return;209 step.endWallTime = Date.now();210 if (result.error) {211 if (typeof result.error === "object" && !result.error?.[stepSymbol])212 result.error[stepSymbol] = step;213 const error = (0, import_util2.testInfoError)(result.error);214 if (step.boxedStack)215 error.stack = `${error.message}216${(0, import_utils.stringifyStackFrames)(step.boxedStack).join("\n")}`;217 step.error = error;218 }219 if (!step.error) {220 for (const childStep of step.steps) {221 if (childStep.error && childStep.infectParentStepsWithError) {222 step.error = childStep.error;223 step.infectParentStepsWithError = true;224 break;225 }226 }227 }228 if (!step.group) {229 const payload = {230 testId: this.testId,231 stepId,232 wallTime: step.endWallTime,233 error: step.error,234 suggestedRebaseline: result.suggestedRebaseline,235 annotations: step.info.annotations236 };237 this._onStepEnd(payload);238 }239 if (step.group !== "internal") {240 const errorForTrace = step.error ? { name: "", message: step.error.message || "", stack: step.error.stack } : void 0;241 const attachments = step.attachmentIndices.map((i) => this.attachments[i]);242 this._tracing.appendAfterActionForStep(stepId, errorForTrace, attachments, step.info.annotations);243 }244 }245 };246 const parentStepList = parentStep ? parentStep.steps : this._steps;247 parentStepList.push(step);248 this._stepMap.set(stepId, step);249 if (!step.group) {250 const payload = {251 testId: this.testId,252 stepId,253 parentStepId: parentStep ? parentStep.stepId : void 0,254 title: step.title,255 category: step.category,256 wallTime: Date.now(),257 location: step.location258 };259 this._onStepBegin(payload);260 }261 if (step.group !== "internal") {262 this._tracing.appendBeforeActionForStep({263 stepId,264 parentId: parentStep?.stepId,265 title: step.title,266 category: step.category,267 params: step.params,268 stack: step.location ? [step.location] : [],269 group: step.group270 });271 }272 return step;273 }274 _interrupt() {275 this._wasInterrupted = true;276 this._timeoutManager.interrupt();277 if (this.status === "passed")278 this.status = "interrupted";279 }280 _failWithError(error) {281 if (this.status === "passed" || this.status === "skipped")282 this.status = error instanceof import_timeoutManager.TimeoutManagerError ? "timedOut" : "failed";283 const serialized = (0, import_util2.testInfoError)(error);284 const step = typeof error === "object" ? error?.[stepSymbol] : void 0;285 if (step && step.boxedStack)286 serialized.stack = `${error.name}: ${error.message}287${(0, import_utils.stringifyStackFrames)(step.boxedStack).join("\n")}`;288 this.errors.push(serialized);289 this._tracing.appendForError(serialized);290 }291 async _runAsStep(stepInfo, cb) {292 const step = this._addStep(stepInfo);293 try {294 await cb();295 step.complete({});296 } catch (error) {297 step.complete({ error });298 throw error;299 }300 }301 async _runWithTimeout(runnable, cb) {302 try {303 await this._timeoutManager.withRunnable(runnable, async () => {304 try {305 await cb();306 } catch (e) {307 if (this._allowSkips && e instanceof TestSkipError) {308 if (this.status === "passed")309 this.status = "skipped";310 } else {311 this._failWithError(e);312 }313 throw e;314 }315 });316 } catch (error) {317 if (!this._wasInterrupted && error instanceof import_timeoutManager.TimeoutManagerError)318 this._failWithError(error);319 throw error;320 }321 }322 _isFailure() {323 return this.status !== "skipped" && this.status !== this.expectedStatus;324 }325 _currentHookType() {326 const type = this._timeoutManager.currentSlotType();327 return ["beforeAll", "afterAll", "beforeEach", "afterEach"].includes(type) ? type : void 0;328 }329 _setDebugMode() {330 this._timeoutManager.setIgnoreTimeouts();331 }332 // ------------ TestInfo methods ------------333 async attach(name, options = {}) {334 const step = this._addStep({335 title: `Attach ${(0, import_utils.escapeWithQuotes)(name, '"')}`,336 category: "test.attach"337 });338 this._attach(339 await (0, import_util.normalizeAndSaveAttachment)(this.outputPath(), name, options),340 step.group ? void 0 : step.stepId341 );342 step.complete({});343 }344 _attach(attachment, stepId) {345 const index = this._attachmentsPush(attachment) - 1;346 if (stepId) {347 this._stepMap.get(stepId).attachmentIndices.push(index);348 } else {349 const stepId2 = `attach@${(0, import_utils.createGuid)()}`;350 this._tracing.appendBeforeActionForStep({ stepId: stepId2, title: `Attach ${(0, import_utils.escapeWithQuotes)(attachment.name, '"')}`, category: "test.attach", stack: [] });351 this._tracing.appendAfterActionForStep(stepId2, void 0, [attachment]);352 }353 this._onAttach({354 testId: this.testId,355 name: attachment.name,356 contentType: attachment.contentType,357 path: attachment.path,358 body: attachment.body?.toString("base64"),359 stepId360 });361 }362 outputPath(...pathSegments) {363 const outputPath = this._getOutputPath(...pathSegments);364 import_fs.default.mkdirSync(this.outputDir, { recursive: true });365 return outputPath;366 }367 _getOutputPath(...pathSegments) {368 const joinedPath = import_path.default.join(...pathSegments);369 const outputPath = (0, import_util.getContainedPath)(this.outputDir, joinedPath);370 if (outputPath)371 return outputPath;372 throw new Error(`The outputPath is not allowed outside of the parent directory. Please fix the defined path.373 374 outputPath: ${joinedPath}`);375 }376 _fsSanitizedTestName() {377 const fullTitleWithoutSpec = this.titlePath.slice(1).join(" ");378 return (0, import_utils.sanitizeForFilePath)((0, import_util.trimLongString)(fullTitleWithoutSpec));379 }380 _resolveSnapshotPaths(kind, name, updateSnapshotIndex, anonymousExtension) {381 const snapshotNames = kind === "aria" ? this._ariaSnapshotNames : this._snapshotNames;382 const defaultExtensions = { "aria": ".aria.yml", "screenshot": ".png", "snapshot": ".txt" };383 const ariaAwareExtname = (filePath) => kind === "aria" && filePath.endsWith(".aria.yml") ? ".aria.yml" : import_path.default.extname(filePath);384 let subPath;385 let ext;386 let relativeOutputPath;387 if (!name) {388 const index = snapshotNames.lastAnonymousSnapshotIndex + 1;389 if (updateSnapshotIndex === "updateSnapshotIndex")390 snapshotNames.lastAnonymousSnapshotIndex = index;391 const fullTitleWithoutSpec = [...this.titlePath.slice(1), index].join(" ");392 ext = anonymousExtension ?? defaultExtensions[kind];393 subPath = (0, import_util.sanitizeFilePathBeforeExtension)((0, import_util.trimLongString)(fullTitleWithoutSpec) + ext, ext);394 relativeOutputPath = (0, import_util.sanitizeFilePathBeforeExtension)((0, import_util.trimLongString)(fullTitleWithoutSpec, import_util.windowsFilesystemFriendlyLength) + ext, ext);395 } else {396 if (Array.isArray(name)) {397 subPath = import_path.default.join(...name);398 relativeOutputPath = import_path.default.join(...name);399 ext = ariaAwareExtname(subPath);400 } else {401 ext = ariaAwareExtname(name);402 subPath = (0, import_util.sanitizeFilePathBeforeExtension)(name, ext);403 relativeOutputPath = (0, import_util.sanitizeFilePathBeforeExtension)((0, import_util.trimLongString)(name, import_util.windowsFilesystemFriendlyLength), ext);404 }405 const index = (snapshotNames.lastNamedSnapshotIndex[relativeOutputPath] || 0) + 1;406 if (updateSnapshotIndex === "updateSnapshotIndex")407 snapshotNames.lastNamedSnapshotIndex[relativeOutputPath] = index;408 if (index > 1)409 relativeOutputPath = (0, import_util.addSuffixToFilePath)(relativeOutputPath, `-${index - 1}`);410 }411 const absoluteSnapshotPath = this._applyPathTemplate(kind, subPath, ext);412 return { absoluteSnapshotPath, relativeOutputPath };413 }414 _applyPathTemplate(kind, relativePath, ext) {415 const legacyTemplate = "{snapshotDir}/{testFileDir}/{testFileName}-snapshots/{arg}{-projectName}{-snapshotSuffix}{ext}";416 let template;417 if (kind === "screenshot") {418 template = this._projectInternal.expect?.toHaveScreenshot?.pathTemplate || this._projectInternal.snapshotPathTemplate || legacyTemplate;419 } else if (kind === "aria") {420 const ariaDefaultTemplate = "{snapshotDir}/{testFileDir}/{testFileName}-snapshots/{arg}{ext}";421 template = this._projectInternal.expect?.toMatchAriaSnapshot?.pathTemplate || this._projectInternal.snapshotPathTemplate || ariaDefaultTemplate;422 } else {423 template = this._projectInternal.snapshotPathTemplate || legacyTemplate;424 }425 const dir = import_path.default.dirname(relativePath);426 const name = import_path.default.basename(relativePath, ext);427 const relativeTestFilePath = import_path.default.relative(this.project.testDir, this._requireFile);428 const parsedRelativeTestFilePath = import_path.default.parse(relativeTestFilePath);429 const projectNamePathSegment = (0, import_utils.sanitizeForFilePath)(this.project.name);430 const snapshotPath = template.replace(/\{(.)?testDir\}/g, "$1" + this.project.testDir).replace(/\{(.)?snapshotDir\}/g, "$1" + this.project.snapshotDir).replace(/\{(.)?snapshotSuffix\}/g, this.snapshotSuffix ? "$1" + this.snapshotSuffix : "").replace(/\{(.)?testFileDir\}/g, "$1" + parsedRelativeTestFilePath.dir).replace(/\{(.)?platform\}/g, "$1" + process.platform).replace(/\{(.)?projectName\}/g, projectNamePathSegment ? "$1" + projectNamePathSegment : "").replace(/\{(.)?testName\}/g, "$1" + this._fsSanitizedTestName()).replace(/\{(.)?testFileName\}/g, "$1" + parsedRelativeTestFilePath.base).replace(/\{(.)?testFilePath\}/g, "$1" + relativeTestFilePath).replace(/\{(.)?arg\}/g, "$1" + import_path.default.join(dir, name)).replace(/\{(.)?ext\}/g, ext ? "$1" + ext : "");431 return import_path.default.normalize(import_path.default.resolve(this._configInternal.configDir, snapshotPath));432 }433 snapshotPath(...args) {434 let name = args;435 let kind = "snapshot";436 const options = args[args.length - 1];437 if (options && typeof options === "object") {438 kind = options.kind ?? kind;439 name = args.slice(0, -1);440 }441 if (!["snapshot", "screenshot", "aria"].includes(kind))442 throw new Error(`testInfo.snapshotPath: unknown kind "${kind}", must be one of "snapshot", "screenshot" or "aria"`);443 return this._resolveSnapshotPaths(kind, name.length <= 1 ? name[0] : name, "dontUpdateSnapshotIndex").absoluteSnapshotPath;444 }445 setTimeout(timeout) {446 this._timeoutManager.setTimeout(timeout);447 }448 _pauseOnError() {449 return this._workerParams.pauseOnError;450 }451 _pauseAtEnd() {452 return this._workerParams.pauseAtEnd;453 }454}455class TestStepInfoImpl {456 constructor(testInfo, stepId, title, parentStep) {457 this.annotations = [];458 this._testInfo = testInfo;459 this._stepId = stepId;460 this._title = title;461 this._parentStep = parentStep;462 this.skip = (0, import_transform.wrapFunctionWithLocation)((location, ...args) => {463 if (args.length > 0 && !args[0])464 return;465 const description = args[1];466 this.annotations.push({ type: "skip", description, location });467 throw new StepSkipError(description);468 });469 }470 async _runStepBody(skip, body, location) {471 if (skip) {472 this.annotations.push({ type: "skip", location });473 return void 0;474 }475 try {476 return await body(this);477 } catch (e) {478 if (e instanceof StepSkipError)479 return void 0;480 throw e;481 }482 }483 _attachToStep(attachment) {484 this._testInfo._attach(attachment, this._stepId);485 }486 async attach(name, options) {487 this._attachToStep(await (0, import_util.normalizeAndSaveAttachment)(this._testInfo.outputPath(), name, options));488 }489 get titlePath() {490 const parent = this._parentStep ?? this._testInfo;491 return [...parent.titlePath, this._title];492 }493}494class TestSkipError extends Error {495}496class StepSkipError extends Error {497}498const stepSymbol = Symbol("step");499// Annotate the CommonJS export names for ESM import in node:5000 && (module.exports = {501 StepSkipError,502 TestInfoImpl,503 TestSkipError,504 TestStepInfoImpl505});506 