Team Ai
Datasetpublic

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.

sourceHugging Faceupdated 2mo agoView on Hugging Face
0likes3.1kdownloads
traceViewer.js241 linesDownload Raw Back to viewer
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 traceViewer_exports = {};30__export(traceViewer_exports, {31  installRootRedirect: () => installRootRedirect,32  openTraceInBrowser: () => openTraceInBrowser,33  openTraceViewerApp: () => openTraceViewerApp,34  runTraceInBrowser: () => runTraceInBrowser,35  runTraceViewerApp: () => runTraceViewerApp,36  startTraceViewerServer: () => startTraceViewerServer37});38module.exports = __toCommonJS(traceViewer_exports);39var import_fs = __toESM(require("fs"));40var import_path = __toESM(require("path"));41var import_utils = require("../../../utils");42var import_utils2 = require("../../../utils");43var import_httpServer = require("../../utils/httpServer");44var import_utilsBundle = require("../../../utilsBundle");45var import_launchApp = require("../../launchApp");46var import_launchApp2 = require("../../launchApp");47var import_playwright = require("../../playwright");48var import_progress = require("../../progress");49function validateTraceUrls(traceUrls) {50  for (const traceUrl of traceUrls) {51    let traceFile = traceUrl;52    if (traceUrl.endsWith(".json"))53      traceFile = traceUrl.substring(0, traceUrl.length - ".json".length);54    if (!traceUrl.startsWith("http://") && !traceUrl.startsWith("https://") && !import_fs.default.existsSync(traceFile) && !import_fs.default.existsSync(traceFile + ".trace"))55      throw new Error(`Trace file ${traceUrl} does not exist!`);56  }57}58async function startTraceViewerServer(options) {59  const server = new import_httpServer.HttpServer();60  server.routePrefix("/trace", (request, response) => {61    const url = new URL("http://localhost" + request.url);62    const relativePath = url.pathname.slice("/trace".length);63    if (process.env.PW_HMR) {64      response.appendHeader("Access-Control-Allow-Origin", "http://localhost:44223");65    }66    if (relativePath.endsWith("/stall.js"))67      return true;68    if (relativePath.startsWith("/file")) {69      try {70        const filePath = url.searchParams.get("path");71        if (import_fs.default.existsSync(filePath))72          return server.serveFile(request, response, url.searchParams.get("path"));73        if (filePath.endsWith(".json")) {74          const traceName = filePath.substring(0, filePath.length - ".json".length);75          response.statusCode = 200;76          response.setHeader("Content-Type", "application/json");77          response.end(JSON.stringify(traceDescriptor(traceName)));78          return true;79        }80      } catch (e) {81      }82      response.statusCode = 404;83      response.end();84      return true;85    }86    const absolutePath = import_path.default.join(__dirname, "..", "..", "..", "vite", "traceViewer", ...relativePath.split("/"));87    return server.serveFile(request, response, absolutePath);88  });89  const transport = options?.transport || (options?.isServer ? new StdinServer() : void 0);90  if (transport)91    server.createWebSocket(transport);92  const { host, port } = options || {};93  await server.start({ preferredPort: port, host });94  return server;95}96async function installRootRedirect(server, traceUrls, options) {97  const params = new URLSearchParams();98  if (import_path.default.sep !== import_path.default.posix.sep)99    params.set("pathSeparator", import_path.default.sep);100  for (const traceUrl of traceUrls)101    params.append("trace", traceUrl);102  if (server.wsGuid())103    params.append("ws", server.wsGuid());104  if (options?.isServer)105    params.append("isServer", "");106  if ((0, import_utils2.isUnderTest)())107    params.append("isUnderTest", "true");108  for (const arg of options.args || [])109    params.append("arg", arg);110  if (options.grep)111    params.append("grep", options.grep);112  if (options.grepInvert)113    params.append("grepInvert", options.grepInvert);114  for (const project of options.project || [])115    params.append("project", project);116  for (const reporter of options.reporter || [])117    params.append("reporter", reporter);118  let baseUrl = ".";119  if (process.env.PW_HMR) {120    baseUrl = "http://localhost:44223";121    params.set("server", server.urlPrefix("precise"));122  }123  const urlPath = `${baseUrl}/trace/${options.webApp || "index.html"}?${params.toString()}`;124  server.routePath("/", (_, response) => {125    response.statusCode = 302;126    response.setHeader("Location", urlPath);127    response.end();128    return true;129  });130}131async function runTraceViewerApp(traceUrls, browserName, options, exitOnClose) {132  validateTraceUrls(traceUrls);133  const server = await startTraceViewerServer(options);134  await installRootRedirect(server, traceUrls, options);135  const page = await openTraceViewerApp(server.urlPrefix("precise"), browserName, options);136  if (exitOnClose)137    page.on("close", () => (0, import_utils.gracefullyProcessExitDoNotHang)(0));138  return page;139}140async function runTraceInBrowser(traceUrls, options) {141  validateTraceUrls(traceUrls);142  const server = await startTraceViewerServer(options);143  await installRootRedirect(server, traceUrls, options);144  await openTraceInBrowser(server.urlPrefix("human-readable"));145}146async function openTraceViewerApp(url, browserName, options) {147  const traceViewerPlaywright = (0, import_playwright.createPlaywright)({ sdkLanguage: "javascript", isInternalPlaywright: true });148  const traceViewerBrowser = (0, import_utils2.isUnderTest)() ? "chromium" : browserName;149  const { context, page } = await (0, import_launchApp2.launchApp)(traceViewerPlaywright[traceViewerBrowser], {150    sdkLanguage: traceViewerPlaywright.options.sdkLanguage,151    windowSize: { width: 1280, height: 800 },152    persistentContextOptions: {153      ...options?.persistentContextOptions,154      cdpPort: (0, import_utils2.isUnderTest)() ? 0 : void 0,155      headless: !!options?.headless,156      colorScheme: (0, import_utils2.isUnderTest)() ? "light" : void 0157    }158  });159  const controller = new import_progress.ProgressController();160  await controller.run(async (progress) => {161    await context._browser._defaultContext._loadDefaultContextAsIs(progress);162    if (process.env.PWTEST_PRINT_WS_ENDPOINT) {163      process.stderr.write("DevTools listening on: " + context._browser.options.wsEndpoint + "\n");164    }165    if (!(0, import_utils2.isUnderTest)())166      await (0, import_launchApp.syncLocalStorageWithSettings)(page, "traceviewer");167    if ((0, import_utils2.isUnderTest)())168      page.on("close", () => context.close({ reason: "Trace viewer closed" }).catch(() => {169      }));170    await page.mainFrame().goto(progress, url);171  });172  return page;173}174async function openTraceInBrowser(url) {175  console.log("\nListening on " + url);176  if (!(0, import_utils2.isUnderTest)())177    await (0, import_utilsBundle.open)(url.replace("0.0.0.0", "localhost")).catch(() => {178    });179}180class StdinServer {181  constructor() {182    process.stdin.on("data", (data) => {183      const url = data.toString().trim();184      if (url === this._traceUrl)185        return;186      if (url.endsWith(".json"))187        this._pollLoadTrace(url);188      else189        this._loadTrace(url);190    });191    process.stdin.on("close", () => (0, import_utils.gracefullyProcessExitDoNotHang)(0));192  }193  onconnect() {194  }195  async dispatch(method, params) {196    if (method === "initialize") {197      if (this._traceUrl)198        this._loadTrace(this._traceUrl);199    }200  }201  onclose() {202  }203  _loadTrace(traceUrl) {204    this._traceUrl = traceUrl;205    clearTimeout(this._pollTimer);206    this.sendEvent?.("loadTraceRequested", { traceUrl });207  }208  _pollLoadTrace(url) {209    this._loadTrace(url);210    this._pollTimer = setTimeout(() => {211      this._pollLoadTrace(url);212    }, 500);213  }214}215function traceDescriptor(traceName) {216  const result = {217    entries: []218  };219  const traceDir = import_path.default.dirname(traceName);220  const traceFile = import_path.default.basename(traceName);221  for (const name of import_fs.default.readdirSync(traceDir)) {222    if (name.startsWith(traceFile))223      result.entries.push({ name, path: import_path.default.join(traceDir, name) });224  }225  const resourcesDir = import_path.default.join(traceDir, "resources");226  if (import_fs.default.existsSync(resourcesDir)) {227    for (const name of import_fs.default.readdirSync(resourcesDir))228      result.entries.push({ name: "resources/" + name, path: import_path.default.join(resourcesDir, name) });229  }230  return result;231}232// Annotate the CommonJS export names for ESM import in node:2330 && (module.exports = {234  installRootRedirect,235  openTraceInBrowser,236  openTraceViewerApp,237  runTraceInBrowser,238  runTraceViewerApp,239  startTraceViewerServer240});241 
Brunobkr/llama.cpp_AlgMor24_github · Team Ai