From 5c89e982cd047185885c8feaf34c00ffcc4cbc94 Mon Sep 17 00:00:00 2001 From: coyotte508 Date: Thu, 14 Nov 2024 02:14:56 +0100 Subject: [PATCH 1/5] =?UTF-8?q?=E2=9C=A8=20Switch=20to=20nodenext=20resolu?= =?UTF-8?q?tion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/tasks/src/default-widget-inputs.ts | 4 +- packages/tasks/src/index.ts | 42 +++--- packages/tasks/src/library-to-tasks.ts | 4 +- packages/tasks/src/local-apps.ts | 6 +- packages/tasks/src/model-data.ts | 6 +- .../tasks/src/model-libraries-snippets.ts | 6 +- packages/tasks/src/model-libraries.ts | 6 +- packages/tasks/src/snippets/common.ts | 2 +- packages/tasks/src/snippets/curl.spec.ts | 4 +- packages/tasks/src/snippets/index.ts | 8 +- packages/tasks/src/snippets/inputs.ts | 6 +- packages/tasks/src/snippets/js.spec.ts | 4 +- packages/tasks/src/snippets/python.spec.ts | 4 +- packages/tasks/src/snippets/types.ts | 2 +- .../src/tasks/audio-classification/data.ts | 2 +- .../tasks/src/tasks/audio-to-audio/data.ts | 2 +- .../automatic-speech-recognition/data.ts | 2 +- .../tasks/src/tasks/depth-estimation/data.ts | 2 +- .../tasks/document-question-answering/data.ts | 2 +- .../src/tasks/feature-extraction/data.ts | 2 +- packages/tasks/src/tasks/fill-mask/data.ts | 2 +- .../src/tasks/image-classification/data.ts | 2 +- .../tasks/image-feature-extraction/data.ts | 2 +- .../src/tasks/image-segmentation/data.ts | 2 +- .../src/tasks/image-text-to-text/data.ts | 2 +- packages/tasks/src/tasks/image-to-3d/data.ts | 2 +- .../tasks/src/tasks/image-to-image/data.ts | 2 +- .../tasks/src/tasks/image-to-text/data.ts | 2 +- packages/tasks/src/tasks/index.ts | 140 +++++++++--------- .../src/tasks/keypoint-detection/data.ts | 2 +- .../tasks/src/tasks/mask-generation/data.ts | 2 +- .../tasks/src/tasks/object-detection/data.ts | 2 +- packages/tasks/src/tasks/placeholder/data.ts | 2 +- .../src/tasks/question-answering/data.ts | 2 +- .../src/tasks/reinforcement-learning/data.ts | 2 +- .../src/tasks/sentence-similarity/data.ts | 2 +- .../tasks/src/tasks/summarization/data.ts | 2 +- .../tasks/table-question-answering/data.ts | 2 +- .../src/tasks/tabular-classification/data.ts | 2 +- .../src/tasks/tabular-regression/data.ts | 2 +- .../src/tasks/text-classification/data.ts | 2 +- .../tasks/src/tasks/text-generation/data.ts | 2 +- packages/tasks/src/tasks/text-to-3d/data.ts | 2 +- .../tasks/src/tasks/text-to-image/data.ts | 2 +- .../tasks/src/tasks/text-to-speech/data.ts | 2 +- .../tasks/src/tasks/text-to-video/data.ts | 2 +- .../src/tasks/token-classification/data.ts | 2 +- packages/tasks/src/tasks/translation/data.ts | 2 +- .../unconditional-image-generation/data.ts | 2 +- .../src/tasks/video-classification/data.ts | 2 +- .../src/tasks/video-text-to-text/data.ts | 2 +- .../tasks/visual-question-answering/data.ts | 2 +- .../tasks/zero-shot-classification/data.ts | 2 +- .../zero-shot-image-classification/data.ts | 2 +- .../tasks/zero-shot-object-detection/data.ts | 2 +- packages/tasks/src/widget-example.ts | 2 +- packages/tasks/tsconfig.json | 6 +- packages/tasks/tsconfig.local.json | 4 + 58 files changed, 172 insertions(+), 164 deletions(-) create mode 100644 packages/tasks/tsconfig.local.json diff --git a/packages/tasks/src/default-widget-inputs.ts b/packages/tasks/src/default-widget-inputs.ts index b0f96ff40..906a0dcc0 100644 --- a/packages/tasks/src/default-widget-inputs.ts +++ b/packages/tasks/src/default-widget-inputs.ts @@ -1,5 +1,5 @@ -import type { WidgetExample } from "./widget-example"; -import type { WidgetType } from "./pipelines"; +import type { WidgetExample } from "./widget-example.js"; +import type { WidgetType } from "./pipelines.js"; type LanguageCode = string; diff --git a/packages/tasks/src/index.ts b/packages/tasks/src/index.ts index e80a9013f..a3f69c2b3 100644 --- a/packages/tasks/src/index.ts +++ b/packages/tasks/src/index.ts @@ -1,7 +1,7 @@ -export { LIBRARY_TASK_MAPPING } from "./library-to-tasks"; -export { MAPPING_DEFAULT_WIDGET } from "./default-widget-inputs"; -export type { TaskData, TaskDemo, TaskDemoEntry, ExampleRepo } from "./tasks"; -export * from "./tasks"; +export { LIBRARY_TASK_MAPPING } from "./library-to-tasks.js"; +export { MAPPING_DEFAULT_WIDGET } from "./default-widget-inputs.js"; +export type { TaskData, TaskDemo, TaskDemoEntry, ExampleRepo } from "./tasks/index.js"; +export * from "./tasks/index.js"; export { PIPELINE_DATA, PIPELINE_TYPES, @@ -13,11 +13,15 @@ export { MODALITY_LABELS, SUBTASK_TYPES, PIPELINE_TYPES_SET, -} from "./pipelines"; -export { ALL_DISPLAY_MODEL_LIBRARY_KEYS, ALL_MODEL_LIBRARY_KEYS, MODEL_LIBRARIES_UI_ELEMENTS } from "./model-libraries"; -export type { LibraryUiElement, ModelLibraryKey } from "./model-libraries"; -export type { ModelData, TransformersInfo } from "./model-data"; -export type { AddedToken, SpecialTokensMap, TokenizerConfig } from "./tokenizer-data"; +} from "./pipelines.js"; +export { + ALL_DISPLAY_MODEL_LIBRARY_KEYS, + ALL_MODEL_LIBRARY_KEYS, + MODEL_LIBRARIES_UI_ELEMENTS, +} from "./model-libraries.js"; +export type { LibraryUiElement, ModelLibraryKey } from "./model-libraries.js"; +export type { ModelData, TransformersInfo } from "./model-data.js"; +export type { AddedToken, SpecialTokensMap, TokenizerConfig } from "./tokenizer-data.js"; export type { WidgetExample, WidgetExampleAttribute, @@ -38,18 +42,18 @@ export type { WidgetExampleOutputLabels, WidgetExampleOutputAnswerScore, WidgetExampleOutputText, -} from "./widget-example"; -export { SPECIAL_TOKENS_ATTRIBUTES } from "./tokenizer-data"; +} from "./widget-example.js"; +export { SPECIAL_TOKENS_ATTRIBUTES } from "./tokenizer-data.js"; -import * as snippets from "./snippets"; -export * from "./gguf"; +import * as snippets from "./snippets/index.js"; +export * from "./gguf.js"; export { snippets }; -export { SKUS, DEFAULT_MEMORY_OPTIONS } from "./hardware"; -export type { HardwareSpec, SkuType } from "./hardware"; -export { LOCAL_APPS } from "./local-apps"; -export type { LocalApp, LocalAppKey, LocalAppSnippet } from "./local-apps"; +export { SKUS, DEFAULT_MEMORY_OPTIONS } from "./hardware.js"; +export type { HardwareSpec, SkuType } from "./hardware.js"; +export { LOCAL_APPS } from "./local-apps.js"; +export type { LocalApp, LocalAppKey, LocalAppSnippet } from "./local-apps.js"; -export { DATASET_LIBRARIES_UI_ELEMENTS } from "./dataset-libraries"; -export type { DatasetLibraryUiElement, DatasetLibraryKey } from "./dataset-libraries"; +export { DATASET_LIBRARIES_UI_ELEMENTS } from "./dataset-libraries.js"; +export type { DatasetLibraryUiElement, DatasetLibraryKey } from "./dataset-libraries.js"; diff --git a/packages/tasks/src/library-to-tasks.ts b/packages/tasks/src/library-to-tasks.ts index c8411fbaa..e3f0f5b60 100644 --- a/packages/tasks/src/library-to-tasks.ts +++ b/packages/tasks/src/library-to-tasks.ts @@ -1,5 +1,5 @@ -import type { ModelLibraryKey } from "./model-libraries"; -import type { PipelineType } from "./pipelines"; +import type { ModelLibraryKey } from "./model-libraries.js"; +import type { PipelineType } from "./pipelines.js"; /** * Mapping from library name to its supported tasks. diff --git a/packages/tasks/src/local-apps.ts b/packages/tasks/src/local-apps.ts index 683b62989..edc7e64fd 100644 --- a/packages/tasks/src/local-apps.ts +++ b/packages/tasks/src/local-apps.ts @@ -1,6 +1,6 @@ -import { parseGGUFQuantLabel } from "./gguf"; -import type { ModelData } from "./model-data"; -import type { PipelineType } from "./pipelines"; +import { parseGGUFQuantLabel } from "./gguf.js"; +import type { ModelData } from "./model-data.js"; +import type { PipelineType } from "./pipelines.js"; export interface LocalAppSnippet { /** diff --git a/packages/tasks/src/model-data.ts b/packages/tasks/src/model-data.ts index 12c8137d9..975517f3a 100644 --- a/packages/tasks/src/model-data.ts +++ b/packages/tasks/src/model-data.ts @@ -1,6 +1,6 @@ -import type { PipelineType } from "./pipelines"; -import type { WidgetExample } from "./widget-example"; -import type { TokenizerConfig } from "./tokenizer-data"; +import type { PipelineType } from "./pipelines.js"; +import type { WidgetExample } from "./widget-example.js"; +import type { TokenizerConfig } from "./tokenizer-data.js"; /** * Public interface for model metadata diff --git a/packages/tasks/src/model-libraries-snippets.ts b/packages/tasks/src/model-libraries-snippets.ts index fa5c87753..523d1a245 100644 --- a/packages/tasks/src/model-libraries-snippets.ts +++ b/packages/tasks/src/model-libraries-snippets.ts @@ -1,6 +1,6 @@ -import type { ModelData } from "./model-data"; -import type { WidgetExampleTextInput, WidgetExampleSentenceSimilarityInput } from "./widget-example"; -import { LIBRARY_TASK_MAPPING } from "./library-to-tasks"; +import type { ModelData } from "./model-data.js"; +import type { WidgetExampleTextInput, WidgetExampleSentenceSimilarityInput } from "./widget-example.js"; +import { LIBRARY_TASK_MAPPING } from "./library-to-tasks.js"; const TAG_CUSTOM_CODE = "custom_code"; diff --git a/packages/tasks/src/model-libraries.ts b/packages/tasks/src/model-libraries.ts index 168f1471a..c4bda8222 100644 --- a/packages/tasks/src/model-libraries.ts +++ b/packages/tasks/src/model-libraries.ts @@ -1,6 +1,6 @@ -import * as snippets from "./model-libraries-snippets"; -import type { ModelData } from "./model-data"; -import type { ElasticSearchQuery } from "./model-libraries-downloads"; +import * as snippets from "./model-libraries-snippets.js"; +import type { ModelData } from "./model-data.js"; +import type { ElasticSearchQuery } from "./model-libraries-downloads.js"; /** * Elements configurable by a model library. diff --git a/packages/tasks/src/snippets/common.ts b/packages/tasks/src/snippets/common.ts index 0f82db815..fe5452f69 100644 --- a/packages/tasks/src/snippets/common.ts +++ b/packages/tasks/src/snippets/common.ts @@ -1,4 +1,4 @@ -import type { ChatCompletionInputMessage, GenerationParameters } from "../tasks"; +import type { ChatCompletionInputMessage, GenerationParameters } from "../tasks/index.js"; export function stringifyMessages( messages: ChatCompletionInputMessage[], diff --git a/packages/tasks/src/snippets/curl.spec.ts b/packages/tasks/src/snippets/curl.spec.ts index 0b854dbb8..9f4c835f7 100644 --- a/packages/tasks/src/snippets/curl.spec.ts +++ b/packages/tasks/src/snippets/curl.spec.ts @@ -1,6 +1,6 @@ -import type { ModelDataMinimal } from "./types"; +import type { ModelDataMinimal } from "./types.js"; import { describe, expect, it } from "vitest"; -import { snippetTextGeneration } from "./curl"; +import { snippetTextGeneration } from "./curl.js"; describe("inference API snippets", () => { it("conversational llm", async () => { diff --git a/packages/tasks/src/snippets/index.ts b/packages/tasks/src/snippets/index.ts index 3cf9b9d23..342cabf50 100644 --- a/packages/tasks/src/snippets/index.ts +++ b/packages/tasks/src/snippets/index.ts @@ -1,6 +1,6 @@ -import * as inputs from "./inputs"; -import * as curl from "./curl"; -import * as python from "./python"; -import * as js from "./js"; +import * as inputs from "./inputs.js"; +import * as curl from "./curl.js"; +import * as python from "./python.js"; +import * as js from "./js.js"; export { inputs, curl, python, js }; diff --git a/packages/tasks/src/snippets/inputs.ts b/packages/tasks/src/snippets/inputs.ts index 70afde388..49e270dff 100644 --- a/packages/tasks/src/snippets/inputs.ts +++ b/packages/tasks/src/snippets/inputs.ts @@ -1,6 +1,6 @@ -import type { PipelineType } from "../pipelines"; -import type { ChatCompletionInputMessage } from "../tasks"; -import type { ModelDataMinimal } from "./types"; +import type { PipelineType } from "../pipelines.js"; +import type { ChatCompletionInputMessage } from "../tasks/index.js"; +import type { ModelDataMinimal } from "./types.js"; const inputsZeroShotClassification = () => `"Hi, I recently bought a device from your company but it is not working as advertised and I would like to get reimbursed!"`; diff --git a/packages/tasks/src/snippets/js.spec.ts b/packages/tasks/src/snippets/js.spec.ts index 778070721..6a76c885c 100644 --- a/packages/tasks/src/snippets/js.spec.ts +++ b/packages/tasks/src/snippets/js.spec.ts @@ -1,6 +1,6 @@ -import type { InferenceSnippet, ModelDataMinimal } from "./types"; +import type { InferenceSnippet, ModelDataMinimal } from "./types.js"; import { describe, expect, it } from "vitest"; -import { snippetTextGeneration } from "./js"; +import { snippetTextGeneration } from "./js.js"; describe("inference API snippets", () => { it("conversational llm", async () => { diff --git a/packages/tasks/src/snippets/python.spec.ts b/packages/tasks/src/snippets/python.spec.ts index 3f1ee4979..ca72f81b5 100644 --- a/packages/tasks/src/snippets/python.spec.ts +++ b/packages/tasks/src/snippets/python.spec.ts @@ -1,6 +1,6 @@ -import type { ModelDataMinimal } from "./types"; +import type { ModelDataMinimal } from "./types.js"; import { describe, expect, it } from "vitest"; -import { snippetConversational } from "./python"; +import { snippetConversational } from "./python.js"; describe("inference API snippets", () => { it("conversational llm", async () => { diff --git a/packages/tasks/src/snippets/types.ts b/packages/tasks/src/snippets/types.ts index 230fdc9b8..c6a78c278 100644 --- a/packages/tasks/src/snippets/types.ts +++ b/packages/tasks/src/snippets/types.ts @@ -1,4 +1,4 @@ -import type { ModelData } from "../model-data"; +import type { ModelData } from "../model-data.js"; /** * Minimal model data required for snippets. diff --git a/packages/tasks/src/tasks/audio-classification/data.ts b/packages/tasks/src/tasks/audio-classification/data.ts index be123d341..8919f81c0 100644 --- a/packages/tasks/src/tasks/audio-classification/data.ts +++ b/packages/tasks/src/tasks/audio-classification/data.ts @@ -1,4 +1,4 @@ -import type { TaskDataCustom } from ".."; +import type { TaskDataCustom } from "../index.js"; const taskData: TaskDataCustom = { datasets: [ diff --git a/packages/tasks/src/tasks/audio-to-audio/data.ts b/packages/tasks/src/tasks/audio-to-audio/data.ts index 9d92983b2..fa1c3a508 100644 --- a/packages/tasks/src/tasks/audio-to-audio/data.ts +++ b/packages/tasks/src/tasks/audio-to-audio/data.ts @@ -1,4 +1,4 @@ -import type { TaskDataCustom } from ".."; +import type { TaskDataCustom } from "../index.js"; const taskData: TaskDataCustom = { datasets: [ diff --git a/packages/tasks/src/tasks/automatic-speech-recognition/data.ts b/packages/tasks/src/tasks/automatic-speech-recognition/data.ts index 89078ce71..323c6fab3 100644 --- a/packages/tasks/src/tasks/automatic-speech-recognition/data.ts +++ b/packages/tasks/src/tasks/automatic-speech-recognition/data.ts @@ -1,4 +1,4 @@ -import type { TaskDataCustom } from ".."; +import type { TaskDataCustom } from "../index.js"; const taskData: TaskDataCustom = { datasets: [ diff --git a/packages/tasks/src/tasks/depth-estimation/data.ts b/packages/tasks/src/tasks/depth-estimation/data.ts index 735f1ccb5..390449149 100644 --- a/packages/tasks/src/tasks/depth-estimation/data.ts +++ b/packages/tasks/src/tasks/depth-estimation/data.ts @@ -1,4 +1,4 @@ -import type { TaskDataCustom } from ".."; +import type { TaskDataCustom } from "../index.js"; const taskData: TaskDataCustom = { datasets: [ diff --git a/packages/tasks/src/tasks/document-question-answering/data.ts b/packages/tasks/src/tasks/document-question-answering/data.ts index f36ed212c..d40cfe613 100644 --- a/packages/tasks/src/tasks/document-question-answering/data.ts +++ b/packages/tasks/src/tasks/document-question-answering/data.ts @@ -1,4 +1,4 @@ -import type { TaskDataCustom } from ".."; +import type { TaskDataCustom } from "../index.js"; const taskData: TaskDataCustom = { datasets: [ diff --git a/packages/tasks/src/tasks/feature-extraction/data.ts b/packages/tasks/src/tasks/feature-extraction/data.ts index 8bf923349..75f5d6f5e 100644 --- a/packages/tasks/src/tasks/feature-extraction/data.ts +++ b/packages/tasks/src/tasks/feature-extraction/data.ts @@ -1,4 +1,4 @@ -import type { TaskDataCustom } from ".."; +import type { TaskDataCustom } from "../index.js"; const taskData: TaskDataCustom = { datasets: [ diff --git a/packages/tasks/src/tasks/fill-mask/data.ts b/packages/tasks/src/tasks/fill-mask/data.ts index 55550f042..1ed7849f1 100644 --- a/packages/tasks/src/tasks/fill-mask/data.ts +++ b/packages/tasks/src/tasks/fill-mask/data.ts @@ -1,4 +1,4 @@ -import type { TaskDataCustom } from ".."; +import type { TaskDataCustom } from "../index.js"; const taskData: TaskDataCustom = { datasets: [ diff --git a/packages/tasks/src/tasks/image-classification/data.ts b/packages/tasks/src/tasks/image-classification/data.ts index 875b19742..a4cd9fd42 100644 --- a/packages/tasks/src/tasks/image-classification/data.ts +++ b/packages/tasks/src/tasks/image-classification/data.ts @@ -1,4 +1,4 @@ -import type { TaskDataCustom } from ".."; +import type { TaskDataCustom } from "../index.js"; const taskData: TaskDataCustom = { datasets: [ diff --git a/packages/tasks/src/tasks/image-feature-extraction/data.ts b/packages/tasks/src/tasks/image-feature-extraction/data.ts index 71861204e..8880d5bf8 100644 --- a/packages/tasks/src/tasks/image-feature-extraction/data.ts +++ b/packages/tasks/src/tasks/image-feature-extraction/data.ts @@ -1,4 +1,4 @@ -import type { TaskDataCustom } from ".."; +import type { TaskDataCustom } from "../index.js"; const taskData: TaskDataCustom = { datasets: [ diff --git a/packages/tasks/src/tasks/image-segmentation/data.ts b/packages/tasks/src/tasks/image-segmentation/data.ts index 5469a30d2..555e5db3e 100644 --- a/packages/tasks/src/tasks/image-segmentation/data.ts +++ b/packages/tasks/src/tasks/image-segmentation/data.ts @@ -1,4 +1,4 @@ -import type { TaskDataCustom } from ".."; +import type { TaskDataCustom } from "../index.js"; const taskData: TaskDataCustom = { datasets: [ diff --git a/packages/tasks/src/tasks/image-text-to-text/data.ts b/packages/tasks/src/tasks/image-text-to-text/data.ts index e096f0195..e77ffc68f 100644 --- a/packages/tasks/src/tasks/image-text-to-text/data.ts +++ b/packages/tasks/src/tasks/image-text-to-text/data.ts @@ -1,4 +1,4 @@ -import type { TaskDataCustom } from ".."; +import type { TaskDataCustom } from "../index.js"; const taskData: TaskDataCustom = { datasets: [ diff --git a/packages/tasks/src/tasks/image-to-3d/data.ts b/packages/tasks/src/tasks/image-to-3d/data.ts index e9dd93651..6556e1b02 100644 --- a/packages/tasks/src/tasks/image-to-3d/data.ts +++ b/packages/tasks/src/tasks/image-to-3d/data.ts @@ -1,4 +1,4 @@ -import type { TaskDataCustom } from ".."; +import type { TaskDataCustom } from "../index.js"; const taskData: TaskDataCustom = { datasets: [ diff --git a/packages/tasks/src/tasks/image-to-image/data.ts b/packages/tasks/src/tasks/image-to-image/data.ts index a08c19edd..fa2ddc248 100644 --- a/packages/tasks/src/tasks/image-to-image/data.ts +++ b/packages/tasks/src/tasks/image-to-image/data.ts @@ -1,4 +1,4 @@ -import type { TaskDataCustom } from ".."; +import type { TaskDataCustom } from "../index.js"; const taskData: TaskDataCustom = { datasets: [ diff --git a/packages/tasks/src/tasks/image-to-text/data.ts b/packages/tasks/src/tasks/image-to-text/data.ts index 64f4fe5c8..a269d9497 100644 --- a/packages/tasks/src/tasks/image-to-text/data.ts +++ b/packages/tasks/src/tasks/image-to-text/data.ts @@ -1,4 +1,4 @@ -import type { TaskDataCustom } from ".."; +import type { TaskDataCustom } from "../index.js"; const taskData: TaskDataCustom = { datasets: [ diff --git a/packages/tasks/src/tasks/index.ts b/packages/tasks/src/tasks/index.ts index 3e9a02663..7392cfa91 100644 --- a/packages/tasks/src/tasks/index.ts +++ b/packages/tasks/src/tasks/index.ts @@ -1,49 +1,49 @@ -import type { PipelineType } from "../pipelines"; -import { PIPELINE_DATA } from "../pipelines"; +import type { PipelineType } from "../pipelines.js"; +import { PIPELINE_DATA } from "../pipelines.js"; -import audioClassification from "./audio-classification/data"; -import audioToAudio from "./audio-to-audio/data"; -import automaticSpeechRecognition from "./automatic-speech-recognition/data"; -import documentQuestionAnswering from "./document-question-answering/data"; -import featureExtraction from "./feature-extraction/data"; -import fillMask from "./fill-mask/data"; -import imageClassification from "./image-classification/data"; -import imageFeatureExtraction from "./image-feature-extraction/data"; -import imageToImage from "./image-to-image/data"; -import imageToText from "./image-to-text/data"; -import imageTextToText from "./image-text-to-text/data"; -import imageSegmentation from "./image-segmentation/data"; -import maskGeneration from "./mask-generation/data"; -import objectDetection from "./object-detection/data"; -import depthEstimation from "./depth-estimation/data"; -import placeholder from "./placeholder/data"; -import reinforcementLearning from "./reinforcement-learning/data"; -import questionAnswering from "./question-answering/data"; -import sentenceSimilarity from "./sentence-similarity/data"; -import summarization from "./summarization/data"; -import tableQuestionAnswering from "./table-question-answering/data"; -import tabularClassification from "./tabular-classification/data"; -import tabularRegression from "./tabular-regression/data"; -import textToImage from "./text-to-image/data"; -import textToSpeech from "./text-to-speech/data"; -import tokenClassification from "./token-classification/data"; -import translation from "./translation/data"; -import textClassification from "./text-classification/data"; -import textGeneration from "./text-generation/data"; -import textToVideo from "./text-to-video/data"; -import unconditionalImageGeneration from "./unconditional-image-generation/data"; -import videoClassification from "./video-classification/data"; -import visualQuestionAnswering from "./visual-question-answering/data"; -import zeroShotClassification from "./zero-shot-classification/data"; -import zeroShotImageClassification from "./zero-shot-image-classification/data"; -import zeroShotObjectDetection from "./zero-shot-object-detection/data"; -import imageTo3D from "./image-to-3d/data"; -import textTo3D from "./text-to-3d/data"; -import keypointDetection from "./keypoint-detection/data"; -import videoTextToText from "./video-text-to-text/data"; +import audioClassification from "./audio-classification/data.js"; +import audioToAudio from "./audio-to-audio/data.js"; +import automaticSpeechRecognition from "./automatic-speech-recognition/data.js"; +import documentQuestionAnswering from "./document-question-answering/data.js"; +import featureExtraction from "./feature-extraction/data.js"; +import fillMask from "./fill-mask/data.js"; +import imageClassification from "./image-classification/data.js"; +import imageFeatureExtraction from "./image-feature-extraction/data.js"; +import imageToImage from "./image-to-image/data.js"; +import imageToText from "./image-to-text/data.js"; +import imageTextToText from "./image-text-to-text/data.js"; +import imageSegmentation from "./image-segmentation/data.js"; +import maskGeneration from "./mask-generation/data.js"; +import objectDetection from "./object-detection/data.js"; +import depthEstimation from "./depth-estimation/data.js"; +import placeholder from "./placeholder/data.js"; +import reinforcementLearning from "./reinforcement-learning/data.js"; +import questionAnswering from "./question-answering/data.js"; +import sentenceSimilarity from "./sentence-similarity/data.js"; +import summarization from "./summarization/data.js"; +import tableQuestionAnswering from "./table-question-answering/data.js"; +import tabularClassification from "./tabular-classification/data.js"; +import tabularRegression from "./tabular-regression/data.js"; +import textToImage from "./text-to-image/data.js"; +import textToSpeech from "./text-to-speech/data.js"; +import tokenClassification from "./token-classification/data.js"; +import translation from "./translation/data.js"; +import textClassification from "./text-classification/data.js"; +import textGeneration from "./text-generation/data.js"; +import textToVideo from "./text-to-video/data.js"; +import unconditionalImageGeneration from "./unconditional-image-generation/data.js"; +import videoClassification from "./video-classification/data.js"; +import visualQuestionAnswering from "./visual-question-answering/data.js"; +import zeroShotClassification from "./zero-shot-classification/data.js"; +import zeroShotImageClassification from "./zero-shot-image-classification/data.js"; +import zeroShotObjectDetection from "./zero-shot-object-detection/data.js"; +import imageTo3D from "./image-to-3d/data.js"; +import textTo3D from "./text-to-3d/data.js"; +import keypointDetection from "./keypoint-detection/data.js"; +import videoTextToText from "./video-text-to-text/data.js"; -export type * from "./audio-classification/inference"; -export type * from "./automatic-speech-recognition/inference"; +export type * from "./audio-classification/inference.js"; +export type * from "./automatic-speech-recognition/inference.js"; export type { ChatCompletionInput, ChatCompletionInputMessage, @@ -53,36 +53,36 @@ export type { ChatCompletionStreamOutput, ChatCompletionStreamOutputChoice, ChatCompletionStreamOutputDelta, -} from "./chat-completion/inference"; -export type * from "./document-question-answering/inference"; -export type * from "./feature-extraction/inference"; -export type * from "./fill-mask/inference"; +} from "./chat-completion/inference.js"; +export type * from "./document-question-answering/inference.js"; +export type * from "./feature-extraction/inference.js"; +export type * from "./fill-mask/inference.js"; export type { ImageClassificationInput, ImageClassificationOutput, ImageClassificationOutputElement, ImageClassificationParameters, -} from "./image-classification/inference"; -export type * from "./image-to-image/inference"; -export type { ImageToTextInput, ImageToTextOutput, ImageToTextParameters } from "./image-to-text/inference"; -export type * from "./image-segmentation/inference"; -export type * from "./object-detection/inference"; -export type * from "./depth-estimation/inference"; -export type * from "./question-answering/inference"; -export type * from "./sentence-similarity/inference"; -export type * from "./summarization/inference"; -export type * from "./table-question-answering/inference"; -export type { TextToImageInput, TextToImageOutput, TextToImageParameters } from "./text-to-image/inference"; -export type { TextToSpeechParameters, TextToSpeechInput, TextToSpeechOutput } from "./text-to-speech/inference"; -export type * from "./token-classification/inference"; -export type { TranslationInput, TranslationOutput } from "./translation/inference"; +} from "./image-classification/inference.js"; +export type * from "./image-to-image/inference.js"; +export type { ImageToTextInput, ImageToTextOutput, ImageToTextParameters } from "./image-to-text/inference.js"; +export type * from "./image-segmentation/inference.js"; +export type * from "./object-detection/inference.js"; +export type * from "./depth-estimation/inference.js"; +export type * from "./question-answering/inference.js"; +export type * from "./sentence-similarity/inference.js"; +export type * from "./summarization/inference.js"; +export type * from "./table-question-answering/inference.js"; +export type { TextToImageInput, TextToImageOutput, TextToImageParameters } from "./text-to-image/inference.js"; +export type { TextToSpeechParameters, TextToSpeechInput, TextToSpeechOutput } from "./text-to-speech/inference.js"; +export type * from "./token-classification/inference.js"; +export type { TranslationInput, TranslationOutput } from "./translation/inference.js"; export type { ClassificationOutputTransform, TextClassificationInput, TextClassificationOutput, TextClassificationOutputElement, TextClassificationParameters, -} from "./text-classification/inference"; +} from "./text-classification/inference.js"; export type { TextGenerationOutputFinishReason, TextGenerationOutputPrefillToken, @@ -94,20 +94,20 @@ export type { TextGenerationOutputToken, TextGenerationStreamOutputStreamDetails, TextGenerationStreamOutput, -} from "./text-generation/inference"; -export type * from "./video-classification/inference"; -export type * from "./visual-question-answering/inference"; -export type * from "./zero-shot-classification/inference"; -export type * from "./zero-shot-image-classification/inference"; +} from "./text-generation/inference.js"; +export type * from "./video-classification/inference.js"; +export type * from "./visual-question-answering/inference.js"; +export type * from "./zero-shot-classification/inference.js"; +export type * from "./zero-shot-image-classification/inference.js"; export type { BoundingBox, ZeroShotObjectDetectionInput, ZeroShotObjectDetectionInputData, ZeroShotObjectDetectionOutput, ZeroShotObjectDetectionOutputElement, -} from "./zero-shot-object-detection/inference"; +} from "./zero-shot-object-detection/inference.js"; -import type { ModelLibraryKey } from "../model-libraries"; +import type { ModelLibraryKey } from "../model-libraries.js"; /** * Model libraries compatible with each ML task diff --git a/packages/tasks/src/tasks/keypoint-detection/data.ts b/packages/tasks/src/tasks/keypoint-detection/data.ts index 194e48d48..e65b805ba 100644 --- a/packages/tasks/src/tasks/keypoint-detection/data.ts +++ b/packages/tasks/src/tasks/keypoint-detection/data.ts @@ -1,4 +1,4 @@ -import type { TaskDataCustom } from ".."; +import type { TaskDataCustom } from "../index.js"; const taskData: TaskDataCustom = { datasets: [ diff --git a/packages/tasks/src/tasks/mask-generation/data.ts b/packages/tasks/src/tasks/mask-generation/data.ts index 6b18b2dbf..133e9a7f6 100644 --- a/packages/tasks/src/tasks/mask-generation/data.ts +++ b/packages/tasks/src/tasks/mask-generation/data.ts @@ -1,4 +1,4 @@ -import type { TaskDataCustom } from ".."; +import type { TaskDataCustom } from "../index.js"; const taskData: TaskDataCustom = { datasets: [], diff --git a/packages/tasks/src/tasks/object-detection/data.ts b/packages/tasks/src/tasks/object-detection/data.ts index 840f7a431..2b1a8a4a9 100644 --- a/packages/tasks/src/tasks/object-detection/data.ts +++ b/packages/tasks/src/tasks/object-detection/data.ts @@ -1,4 +1,4 @@ -import type { TaskDataCustom } from ".."; +import type { TaskDataCustom } from "../index.js"; const taskData: TaskDataCustom = { datasets: [ diff --git a/packages/tasks/src/tasks/placeholder/data.ts b/packages/tasks/src/tasks/placeholder/data.ts index 110b43703..5fc9bbb8f 100644 --- a/packages/tasks/src/tasks/placeholder/data.ts +++ b/packages/tasks/src/tasks/placeholder/data.ts @@ -1,4 +1,4 @@ -import type { TaskDataCustom } from ".."; +import type { TaskDataCustom } from "../index.js"; const taskData: TaskDataCustom = { datasets: [], diff --git a/packages/tasks/src/tasks/question-answering/data.ts b/packages/tasks/src/tasks/question-answering/data.ts index ac1443adf..cf75dd3d7 100644 --- a/packages/tasks/src/tasks/question-answering/data.ts +++ b/packages/tasks/src/tasks/question-answering/data.ts @@ -1,4 +1,4 @@ -import type { TaskDataCustom } from ".."; +import type { TaskDataCustom } from "../index.js"; const taskData: TaskDataCustom = { datasets: [ diff --git a/packages/tasks/src/tasks/reinforcement-learning/data.ts b/packages/tasks/src/tasks/reinforcement-learning/data.ts index 71290d677..231ecabda 100644 --- a/packages/tasks/src/tasks/reinforcement-learning/data.ts +++ b/packages/tasks/src/tasks/reinforcement-learning/data.ts @@ -1,4 +1,4 @@ -import type { TaskDataCustom } from ".."; +import type { TaskDataCustom } from "../index.js"; const taskData: TaskDataCustom = { datasets: [ diff --git a/packages/tasks/src/tasks/sentence-similarity/data.ts b/packages/tasks/src/tasks/sentence-similarity/data.ts index 3ef54bbd3..ff6b877a0 100644 --- a/packages/tasks/src/tasks/sentence-similarity/data.ts +++ b/packages/tasks/src/tasks/sentence-similarity/data.ts @@ -1,4 +1,4 @@ -import type { TaskDataCustom } from ".."; +import type { TaskDataCustom } from "../index.js"; const taskData: TaskDataCustom = { datasets: [ diff --git a/packages/tasks/src/tasks/summarization/data.ts b/packages/tasks/src/tasks/summarization/data.ts index 239a04fc4..de7eb4e4c 100644 --- a/packages/tasks/src/tasks/summarization/data.ts +++ b/packages/tasks/src/tasks/summarization/data.ts @@ -1,4 +1,4 @@ -import type { TaskDataCustom } from ".."; +import type { TaskDataCustom } from "../index.js"; const taskData: TaskDataCustom = { canonicalId: "text2text-generation", diff --git a/packages/tasks/src/tasks/table-question-answering/data.ts b/packages/tasks/src/tasks/table-question-answering/data.ts index 7a4691146..b5f161a4c 100644 --- a/packages/tasks/src/tasks/table-question-answering/data.ts +++ b/packages/tasks/src/tasks/table-question-answering/data.ts @@ -1,4 +1,4 @@ -import type { TaskDataCustom } from ".."; +import type { TaskDataCustom } from "../index.js"; const taskData: TaskDataCustom = { datasets: [ diff --git a/packages/tasks/src/tasks/tabular-classification/data.ts b/packages/tasks/src/tasks/tabular-classification/data.ts index c7284cc50..80dbe57d2 100644 --- a/packages/tasks/src/tasks/tabular-classification/data.ts +++ b/packages/tasks/src/tasks/tabular-classification/data.ts @@ -1,4 +1,4 @@ -import type { TaskDataCustom } from ".."; +import type { TaskDataCustom } from "../index.js"; const taskData: TaskDataCustom = { datasets: [ diff --git a/packages/tasks/src/tasks/tabular-regression/data.ts b/packages/tasks/src/tasks/tabular-regression/data.ts index d4f085d24..c4c0b6d01 100644 --- a/packages/tasks/src/tasks/tabular-regression/data.ts +++ b/packages/tasks/src/tasks/tabular-regression/data.ts @@ -1,4 +1,4 @@ -import type { TaskDataCustom } from ".."; +import type { TaskDataCustom } from "../index.js"; const taskData: TaskDataCustom = { datasets: [ diff --git a/packages/tasks/src/tasks/text-classification/data.ts b/packages/tasks/src/tasks/text-classification/data.ts index b6a26dcc4..5ba1506e9 100644 --- a/packages/tasks/src/tasks/text-classification/data.ts +++ b/packages/tasks/src/tasks/text-classification/data.ts @@ -1,4 +1,4 @@ -import type { TaskDataCustom } from ".."; +import type { TaskDataCustom } from "../index.js"; const taskData: TaskDataCustom = { datasets: [ diff --git a/packages/tasks/src/tasks/text-generation/data.ts b/packages/tasks/src/tasks/text-generation/data.ts index ce2240bde..3b783161f 100644 --- a/packages/tasks/src/tasks/text-generation/data.ts +++ b/packages/tasks/src/tasks/text-generation/data.ts @@ -1,4 +1,4 @@ -import type { TaskDataCustom } from ".."; +import type { TaskDataCustom } from "../index.js"; const taskData: TaskDataCustom = { datasets: [ diff --git a/packages/tasks/src/tasks/text-to-3d/data.ts b/packages/tasks/src/tasks/text-to-3d/data.ts index e66a21275..30f3aefc4 100644 --- a/packages/tasks/src/tasks/text-to-3d/data.ts +++ b/packages/tasks/src/tasks/text-to-3d/data.ts @@ -1,4 +1,4 @@ -import type { TaskDataCustom } from ".."; +import type { TaskDataCustom } from "../index.js"; const taskData: TaskDataCustom = { datasets: [ diff --git a/packages/tasks/src/tasks/text-to-image/data.ts b/packages/tasks/src/tasks/text-to-image/data.ts index 82d5473e7..ebf1347d3 100644 --- a/packages/tasks/src/tasks/text-to-image/data.ts +++ b/packages/tasks/src/tasks/text-to-image/data.ts @@ -1,4 +1,4 @@ -import type { TaskDataCustom } from ".."; +import type { TaskDataCustom } from "../index.js"; const taskData: TaskDataCustom = { datasets: [ diff --git a/packages/tasks/src/tasks/text-to-speech/data.ts b/packages/tasks/src/tasks/text-to-speech/data.ts index 464a39afc..afa7471cf 100644 --- a/packages/tasks/src/tasks/text-to-speech/data.ts +++ b/packages/tasks/src/tasks/text-to-speech/data.ts @@ -1,4 +1,4 @@ -import type { TaskDataCustom } from ".."; +import type { TaskDataCustom } from "../index.js"; const taskData: TaskDataCustom = { canonicalId: "text-to-audio", diff --git a/packages/tasks/src/tasks/text-to-video/data.ts b/packages/tasks/src/tasks/text-to-video/data.ts index 27f4925ba..ad9867de2 100644 --- a/packages/tasks/src/tasks/text-to-video/data.ts +++ b/packages/tasks/src/tasks/text-to-video/data.ts @@ -1,4 +1,4 @@ -import type { TaskDataCustom } from ".."; +import type { TaskDataCustom } from "../index.js"; const taskData: TaskDataCustom = { datasets: [ diff --git a/packages/tasks/src/tasks/token-classification/data.ts b/packages/tasks/src/tasks/token-classification/data.ts index 7a1d1abed..2ecce1bcc 100644 --- a/packages/tasks/src/tasks/token-classification/data.ts +++ b/packages/tasks/src/tasks/token-classification/data.ts @@ -1,4 +1,4 @@ -import type { TaskDataCustom } from ".."; +import type { TaskDataCustom } from "../index.js"; const taskData: TaskDataCustom = { datasets: [ diff --git a/packages/tasks/src/tasks/translation/data.ts b/packages/tasks/src/tasks/translation/data.ts index 9707734d9..535f9a84c 100644 --- a/packages/tasks/src/tasks/translation/data.ts +++ b/packages/tasks/src/tasks/translation/data.ts @@ -1,4 +1,4 @@ -import type { TaskDataCustom } from ".."; +import type { TaskDataCustom } from "../index.js"; const taskData: TaskDataCustom = { canonicalId: "text2text-generation", diff --git a/packages/tasks/src/tasks/unconditional-image-generation/data.ts b/packages/tasks/src/tasks/unconditional-image-generation/data.ts index 8cbf8a016..fcd66648e 100644 --- a/packages/tasks/src/tasks/unconditional-image-generation/data.ts +++ b/packages/tasks/src/tasks/unconditional-image-generation/data.ts @@ -1,4 +1,4 @@ -import type { TaskDataCustom } from ".."; +import type { TaskDataCustom } from "../index.js"; const taskData: TaskDataCustom = { datasets: [ diff --git a/packages/tasks/src/tasks/video-classification/data.ts b/packages/tasks/src/tasks/video-classification/data.ts index 47d2c2d75..1e5abbce9 100644 --- a/packages/tasks/src/tasks/video-classification/data.ts +++ b/packages/tasks/src/tasks/video-classification/data.ts @@ -1,4 +1,4 @@ -import type { TaskDataCustom } from ".."; +import type { TaskDataCustom } from "../index.js"; const taskData: TaskDataCustom = { datasets: [ diff --git a/packages/tasks/src/tasks/video-text-to-text/data.ts b/packages/tasks/src/tasks/video-text-to-text/data.ts index eed4add06..bca190bc5 100644 --- a/packages/tasks/src/tasks/video-text-to-text/data.ts +++ b/packages/tasks/src/tasks/video-text-to-text/data.ts @@ -1,4 +1,4 @@ -import type { TaskDataCustom } from ".."; +import type { TaskDataCustom } from "../index.js"; const taskData: TaskDataCustom = { datasets: [ diff --git a/packages/tasks/src/tasks/visual-question-answering/data.ts b/packages/tasks/src/tasks/visual-question-answering/data.ts index f31334330..51de32a80 100644 --- a/packages/tasks/src/tasks/visual-question-answering/data.ts +++ b/packages/tasks/src/tasks/visual-question-answering/data.ts @@ -1,4 +1,4 @@ -import type { TaskDataCustom } from ".."; +import type { TaskDataCustom } from "../index.js"; const taskData: TaskDataCustom = { datasets: [ diff --git a/packages/tasks/src/tasks/zero-shot-classification/data.ts b/packages/tasks/src/tasks/zero-shot-classification/data.ts index 1ecc51c95..516efa4d1 100644 --- a/packages/tasks/src/tasks/zero-shot-classification/data.ts +++ b/packages/tasks/src/tasks/zero-shot-classification/data.ts @@ -1,4 +1,4 @@ -import type { TaskDataCustom } from ".."; +import type { TaskDataCustom } from "../index.js"; const taskData: TaskDataCustom = { datasets: [ diff --git a/packages/tasks/src/tasks/zero-shot-image-classification/data.ts b/packages/tasks/src/tasks/zero-shot-image-classification/data.ts index 5be19aedf..776a6d194 100644 --- a/packages/tasks/src/tasks/zero-shot-image-classification/data.ts +++ b/packages/tasks/src/tasks/zero-shot-image-classification/data.ts @@ -1,4 +1,4 @@ -import type { TaskDataCustom } from ".."; +import type { TaskDataCustom } from "../index.js"; const taskData: TaskDataCustom = { datasets: [ diff --git a/packages/tasks/src/tasks/zero-shot-object-detection/data.ts b/packages/tasks/src/tasks/zero-shot-object-detection/data.ts index 9e36cad46..6446704d4 100644 --- a/packages/tasks/src/tasks/zero-shot-object-detection/data.ts +++ b/packages/tasks/src/tasks/zero-shot-object-detection/data.ts @@ -1,4 +1,4 @@ -import type { TaskDataCustom } from ".."; +import type { TaskDataCustom } from "../index.js"; const taskData: TaskDataCustom = { datasets: [], diff --git a/packages/tasks/src/widget-example.ts b/packages/tasks/src/widget-example.ts index 3c47530f4..780953bca 100644 --- a/packages/tasks/src/widget-example.ts +++ b/packages/tasks/src/widget-example.ts @@ -2,7 +2,7 @@ * See default-widget-inputs.ts for the default widget inputs, this files only contains the types */ -import type { ChatCompletionInputMessage } from "./tasks"; +import type { ChatCompletionInputMessage } from "./tasks/index.js"; type TableData = Record; diff --git a/packages/tasks/tsconfig.json b/packages/tasks/tsconfig.json index 6a2bad758..3e3c571e5 100644 --- a/packages/tasks/tsconfig.json +++ b/packages/tasks/tsconfig.json @@ -2,9 +2,9 @@ "compilerOptions": { "allowSyntheticDefaultImports": true, "lib": ["ES2022", "DOM"], - "module": "ESNext", + "module": "NodeNext", "target": "ESNext", - "moduleResolution": "node", + "moduleResolution": "nodenext", "forceConsistentCasingInFileNames": true, "strict": true, "noImplicitAny": true, @@ -15,6 +15,6 @@ "declaration": true, "declarationMap": true }, - "include": ["src", "scripts"], + "include": ["src"], "exclude": ["dist"] } diff --git a/packages/tasks/tsconfig.local.json b/packages/tasks/tsconfig.local.json new file mode 100644 index 000000000..aefb17827 --- /dev/null +++ b/packages/tasks/tsconfig.local.json @@ -0,0 +1,4 @@ +{ + "extends": "./tsconfig.json", + "include": ["src", "scripts"] +} From a282b6e8243b85c62b88a9f323df6945095df07d Mon Sep 17 00:00:00 2001 From: coyotte508 Date: Thu, 14 Nov 2024 02:33:06 +0100 Subject: [PATCH 2/5] =?UTF-8?q?=E2=9C=A8=20Fix=20types=20in=20published=20?= =?UTF-8?q?tasks=20package?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/tasks/package.json | 6 +++--- packages/tasks/scripts/generate-cts.ts | 18 ++++++++++++++++++ packages/tasks/tsconfig.json | 2 +- packages/tasks/tsconfig.local.json | 4 ++++ 4 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 packages/tasks/scripts/generate-cts.ts create mode 100644 packages/tasks/tsconfig.local.json diff --git a/packages/tasks/package.json b/packages/tasks/package.json index ad7193d93..7b46ece73 100644 --- a/packages/tasks/package.json +++ b/packages/tasks/package.json @@ -9,10 +9,9 @@ }, "main": "./dist/index.cjs", "module": "./dist/index.js", - "types": "./dist/src/index.d.ts", + "types": "./dist/index.d.ts", "exports": { ".": { - "types": "./dist/src/index.d.ts", "require": "./dist/index.cjs", "import": "./dist/index.js" } @@ -24,13 +23,14 @@ "format": "prettier --write .", "format:check": "prettier --check .", "prepublishOnly": "pnpm run inference-codegen && git diff --name-only --exit-code src && pnpm run build", - "build": "tsup src/index.ts --format cjs,esm --clean && tsc --emitDeclarationOnly --declaration", + "build": "tsup src/index.ts --format cjs,esm --clean && tsc --emitDeclarationOnly --declaration && pnpm run generate-cts", "watch:export": "tsup src/index.ts --format cjs,esm --watch", "watch:types": "tsc --emitDeclarationOnly --declaration --watch", "watch": "npm-run-all --parallel watch:export watch:types", "prepare": "pnpm run build", "check": "tsc", "test": "vitest run", + "generate-cts": "tsx scripts/generate-cts.ts", "inference-codegen": "tsx scripts/inference-codegen.ts && prettier --write src/tasks/*/inference.ts", "inference-tgi-import": "tsx scripts/inference-tgi-import.ts && prettier --write src/tasks/text-generation/spec/*.json && prettier --write src/tasks/chat-completion/spec/*.json", "inference-tei-import": "tsx scripts/inference-tei-import.ts && prettier --write src/tasks/feature-extraction/spec/*.json" diff --git a/packages/tasks/scripts/generate-cts.ts b/packages/tasks/scripts/generate-cts.ts new file mode 100644 index 000000000..fc53438ce --- /dev/null +++ b/packages/tasks/scripts/generate-cts.ts @@ -0,0 +1,18 @@ +import { readdirSync, readFileSync, statSync, writeFileSync } from "node:fs"; +import { join } from "node:path"; + +function recursiveCopy(path: string) { + for (const item of readdirSync(path)) { + if (item.endsWith(".d.ts")) { + const content = readFileSync(join(path, item), "utf-8"); + writeFileSync(join(path, item.replace(".d.ts", ".d.cts")), content.replaceAll(".d.ts.map", ".d.cts.map")); + } else if (item.endsWith(".d.ts.map")) { + const content = readFileSync(join(path, item), "utf-8"); + writeFileSync(join(path, item.replace(".d.ts.map", ".d.cts.map")), content.replaceAll(".d.ts", ".d.cts")); + } else if (statSync(join(path, item)).isDirectory()) { + recursiveCopy(join(path, item)); + } + } +} + +recursiveCopy("dist"); diff --git a/packages/tasks/tsconfig.json b/packages/tasks/tsconfig.json index 6a2bad758..157abae98 100644 --- a/packages/tasks/tsconfig.json +++ b/packages/tasks/tsconfig.json @@ -15,6 +15,6 @@ "declaration": true, "declarationMap": true }, - "include": ["src", "scripts"], + "include": ["src"], "exclude": ["dist"] } diff --git a/packages/tasks/tsconfig.local.json b/packages/tasks/tsconfig.local.json new file mode 100644 index 000000000..aefb17827 --- /dev/null +++ b/packages/tasks/tsconfig.local.json @@ -0,0 +1,4 @@ +{ + "extends": "./tsconfig.json", + "include": ["src", "scripts"] +} From 451a223f52740986702ab48814ceb7f6220e3116 Mon Sep 17 00:00:00 2001 From: coyotte508 Date: Thu, 14 Nov 2024 02:36:17 +0100 Subject: [PATCH 3/5] =?UTF-8?q?=E2=9C=A8=20Also=20export=20snippet=20types?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/tasks/src/snippets/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/tasks/src/snippets/index.ts b/packages/tasks/src/snippets/index.ts index 3cf9b9d23..ea1d0b9a5 100644 --- a/packages/tasks/src/snippets/index.ts +++ b/packages/tasks/src/snippets/index.ts @@ -2,5 +2,6 @@ import * as inputs from "./inputs"; import * as curl from "./curl"; import * as python from "./python"; import * as js from "./js"; +export * from "./types"; export { inputs, curl, python, js }; From 3ed1667b77a5440cd74e51ca228247bce019cc94 Mon Sep 17 00:00:00 2001 From: coyotte508 Date: Thu, 14 Nov 2024 02:47:45 +0100 Subject: [PATCH 4/5] =?UTF-8?q?=E2=9C=85=20Larger=20timeout=20for=20gguf?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/gguf/src/gguf.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/gguf/src/gguf.spec.ts b/packages/gguf/src/gguf.spec.ts index 5e1d08226..58852dbee 100644 --- a/packages/gguf/src/gguf.spec.ts +++ b/packages/gguf/src/gguf.spec.ts @@ -33,7 +33,7 @@ describe("gguf", () => { const arrayBuf = await res.arrayBuffer(); fs.writeFileSync(".cache/model.gguf", Buffer.from(arrayBuf)); } - }); + }, 30_000); it("should parse a llama2 7b", async () => { const { metadata, tensorInfos } = await gguf(URL_LLAMA); From 31c8f4fad389c1dec4ca8a1caa9ae2cf7e18c6e3 Mon Sep 17 00:00:00 2001 From: coyotte508 Date: Thu, 14 Nov 2024 02:54:14 +0100 Subject: [PATCH 5/5] =?UTF-8?q?=F0=9F=92=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/tasks/scripts/generate-cts.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/tasks/scripts/generate-cts.ts b/packages/tasks/scripts/generate-cts.ts index fc53438ce..4c128a984 100644 --- a/packages/tasks/scripts/generate-cts.ts +++ b/packages/tasks/scripts/generate-cts.ts @@ -1,3 +1,4 @@ +// Just copy over the already generated .d.ts and .d.ts.map files to .d.cts and .d.cts.map files import { readdirSync, readFileSync, statSync, writeFileSync } from "node:fs"; import { join } from "node:path";