Skip to content

Commit b70ac6c

Browse files
authored
✨ [Tasks] JSON Schema spec for Inference types + TS type generation (#449)
# TL;DR - Introduces specification for inference input/output types for each task, in JSON Schema format - Add a "script" to generate typescript code from that JSON spec using [`quicktype-core`](https://github.com/glideapps/quicktype/tree/master/packages/quicktype-core) - Introduces `quicktype-core` as a dev dependency (from our fork of quicktype https://github.com/huggingface/quicktype/releases/tag/pack-18.0.15) - License: Apache-2.0 # TODO - [x] Add a `text2text-generation` task to serve as a "canonical reference" for `summarization` & `translation` - [x] Add a `text-to-audio` task to server as a "canonical reference" for `text-to-speech` - [ ] Code generation tweaks - [x] Change `any` types to `unknown` - [x] Generate output types for `sentence-similarity` - [ ] Generate output types for `feature-extraction` -> Let's do that later? - [x] add placeholder specs
1 parent c51dea8 commit b70ac6c

File tree

96 files changed

+4355
-3
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+4355
-3
lines changed

.vscode/settings.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,10 @@
66
},
77
"[svelte]": {
88
"editor.defaultFormatter": "esbenp.prettier-vscode"
9+
},
10+
"prettier.configPath": ".prettierrc",
11+
"json.format.enable": false,
12+
"[json]": {
13+
"editor.defaultFormatter": "esbenp.prettier-vscode"
914
}
1015
}

packages/tasks/package.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,10 @@
2424
"format": "prettier --write .",
2525
"format:check": "prettier --check .",
2626
"prepublishOnly": "pnpm run build",
27-
"build": "tsup src/index.ts --format cjs,esm --clean --dts",
27+
"build": "tsup src/index.ts src/scripts/**.ts --format cjs,esm --clean --dts",
2828
"prepare": "pnpm run build",
29-
"check": "tsc"
29+
"check": "tsc",
30+
"inference-codegen": "pnpm run build && node dist/scripts/inference-codegen.js"
3031
},
3132
"files": [
3233
"dist",
@@ -40,5 +41,8 @@
4041
],
4142
"author": "Hugging Face",
4243
"license": "MIT",
43-
"devDependencies": {}
44+
"devDependencies": {
45+
"@types/node": "^20.11.5",
46+
"quicktype-core": "https://github.com/huggingface/quicktype/raw/pack-18.0.15/packages/quicktype-core/quicktype-core-18.0.15.tgz"
47+
}
4448
}

packages/tasks/pnpm-lock.yaml

Lines changed: 209 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)