├── .github └── workflows │ ├── accelerate_doc.yml │ ├── build_main_documentation.yml │ ├── build_pr_documentation.yml │ ├── delete_old_pr_documentations.yml │ ├── lint-svelte-kit.yml │ ├── quality.yml │ ├── test.yml │ └── upload_pr_documentation.yml ├── .gitignore ├── LICENSE ├── MANIFEST.in ├── Makefile ├── README.md ├── kit ├── .eslintignore ├── .eslintrc.cjs ├── .gitignore ├── .npmrc ├── .prettierignore ├── .prettierrc ├── package-lock.json ├── package.json ├── postbuild.sh ├── postcss.config.cjs ├── postprocess.js ├── preprocessors │ ├── docstring.js │ ├── frameworkcontent.js │ ├── hashInCode.js │ ├── hfOptions.js │ ├── index.js │ ├── inferenceSnippet.js │ ├── mdsvex │ │ └── index.js │ ├── tokenizersLang.js │ └── utils.js ├── src │ ├── app.css │ ├── app.d.ts │ ├── app.html │ ├── lib │ │ ├── Added.svelte │ │ ├── Changed.svelte │ │ ├── CodeBlock.svelte │ │ ├── CodeBlockFw.svelte │ │ ├── ColabDropdown.svelte │ │ ├── CopyButton.svelte │ │ ├── CourseFloatingBanner.svelte │ │ ├── Deprecated.svelte │ │ ├── DocNotebookDropdown.svelte │ │ ├── Docstring.svelte │ │ ├── Dropdown.svelte │ │ ├── DropdownEntry.svelte │ │ ├── DropdownMenu.svelte │ │ ├── EditOnGithub.svelte │ │ ├── ExampleCodeBlock.svelte │ │ ├── FrameworkContent.svelte │ │ ├── FrameworkContentBlock.svelte │ │ ├── FrameworkSwitch.svelte │ │ ├── FrameworkSwitchCourse.svelte │ │ ├── Heading.svelte │ │ ├── HfOption.svelte │ │ ├── HfOptions.svelte │ │ ├── IconCaretDown.svelte │ │ ├── IconCopy.svelte │ │ ├── IconCopyLink.svelte │ │ ├── IconCurl.svelte │ │ ├── IconEyeHide.svelte │ │ ├── IconEyeShow.svelte │ │ ├── IconJax.svelte │ │ ├── IconJs.svelte │ │ ├── IconNode.svelte │ │ ├── IconPython.svelte │ │ ├── IconPytorch.svelte │ │ ├── IconRust.svelte │ │ ├── IconTensorflow.svelte │ │ ├── InferenceApi.svelte │ │ ├── InferenceSnippet │ │ │ ├── IconInferenceBlackForest.svelte │ │ │ ├── IconInferenceCerebras.svelte │ │ │ ├── IconInferenceCohere.svelte │ │ │ ├── IconInferenceFal.svelte │ │ │ ├── IconInferenceFeatherless.svelte │ │ │ ├── IconInferenceFireworks.svelte │ │ │ ├── IconInferenceGroq.svelte │ │ │ ├── IconInferenceHf.svelte │ │ │ ├── IconInferenceHyperbolic.svelte │ │ │ ├── IconInferenceNebius.svelte │ │ │ ├── IconInferenceNovita.svelte │ │ │ ├── IconInferenceNscale.svelte │ │ │ ├── IconInferenceReplicate.svelte │ │ │ ├── IconInferenceSambaNova.svelte │ │ │ ├── IconInferenceTogetherAI.svelte │ │ │ ├── IconLinkExternal.svelte │ │ │ ├── IconSettings.svelte │ │ │ └── InferenceSnippet.svelte │ │ ├── Markdown.svelte │ │ ├── PipelineIcon.svelte │ │ ├── PipelineIcons │ │ │ ├── IconAudioClassification.svelte │ │ │ ├── IconAudioToAudio.svelte │ │ │ ├── IconAutomaticSpeechRecognition.svelte │ │ │ ├── IconConversational.svelte │ │ │ ├── IconDocumentQuestionAnswering.svelte │ │ │ ├── IconFeatureExtraction.svelte │ │ │ ├── IconFillMask.svelte │ │ │ ├── IconImageClassification.svelte │ │ │ ├── IconImageSegmentation.svelte │ │ │ ├── IconImageToImage.svelte │ │ │ ├── IconImageToText.svelte │ │ │ ├── IconObjectDetection.svelte │ │ │ ├── IconQuestionAnswering.svelte │ │ │ ├── IconReinforcementLearning.svelte │ │ │ ├── IconRobotics.svelte │ │ │ ├── IconSentenceSimilarity.svelte │ │ │ ├── IconSummarization.svelte │ │ │ ├── IconTableQuestionAnswering.svelte │ │ │ ├── IconTabularClassification.svelte │ │ │ ├── IconTabularRegression.svelte │ │ │ ├── IconText2textGeneration.svelte │ │ │ ├── IconTextClassification.svelte │ │ │ ├── IconTextGeneration.svelte │ │ │ ├── IconTextToImage.svelte │ │ │ ├── IconTextToSpeech.svelte │ │ │ ├── IconTokenClassification.svelte │ │ │ ├── IconTranslation.svelte │ │ │ ├── IconUnconditionalImageGeneration.svelte │ │ │ ├── IconVoiceActivityDetection.svelte │ │ │ └── IconZeroShotClassification.svelte │ │ ├── PipelineTag.svelte │ │ ├── Question.svelte │ │ ├── Tip.svelte │ │ ├── TokenizersLanguageContent.svelte │ │ ├── Tooltip.svelte │ │ ├── TooltipFromAction.svelte │ │ ├── Youtube.svelte │ │ ├── copyToClipboard.ts │ │ ├── pipeline.ts │ │ ├── stores.ts │ │ ├── tooltip.ts │ │ ├── types.ts │ │ └── utils.ts │ └── routes │ │ ├── +layout.svelte │ │ ├── +layout.ts │ │ └── endpoints │ │ └── toc │ │ └── +server.ts ├── static │ └── favicon.png ├── svelte.config.js ├── svelteKitCustomClient │ ├── README.md │ ├── client.js │ └── replace.js ├── tailwind.config.cjs ├── tsconfig.json └── vite.config.ts ├── pyproject.toml ├── scripts ├── .prettierrc └── delete-old-prs.ts ├── setup.cfg ├── setup.py ├── src └── doc_builder │ ├── __init__.py │ ├── autodoc.py │ ├── build_doc.py │ ├── commands │ ├── __init__.py │ ├── build.py │ ├── convert_doc_file.py │ ├── doc_builder_cli.py │ ├── notebook_to_mdx.py │ ├── preview.py │ ├── push.py │ └── style.py │ ├── convert_md_to_mdx.py │ ├── convert_rst_to_mdx.py │ ├── convert_to_notebook.py │ ├── external.py │ ├── style_doc.py │ └── utils.py └── tests ├── data ├── convert_include_dummy.txt └── convert_literalinclude_dummy.txt ├── test_autodoc.py ├── test_build_doc.py ├── test_convert_doc_file.py ├── test_convert_md_to_mdx.py ├── test_convert_rst_to_mdx.py ├── test_convert_to_notebook.py ├── test_style_doc.py └── test_utils.py /.github/workflows/accelerate_doc.yml: -------------------------------------------------------------------------------- 1 | name: Accelerate doc build 2 | 3 | on: [pull_request] 4 | 5 | jobs: 6 | integration_doc_build: 7 | runs-on: ubuntu-latest 8 | defaults: 9 | run: 10 | shell: bash -l {0} 11 | 12 | steps: 13 | - uses: actions/setup-node@v4 14 | with: 15 | node-version: '20' 16 | 17 | - uses: actions/checkout@v4 18 | with: 19 | repository: 'huggingface/doc-builder' 20 | path: doc-builder 21 | 22 | - uses: actions/checkout@v4 23 | with: 24 | repository: 'huggingface/accelerate' 25 | path: accelerate 26 | ref: 16eb6d76bf987c7d8d877ce5152f2e29878eab37 27 | 28 | - name: Set up Python 29 | uses: actions/setup-python@v4 30 | with: 31 | python-version: '3.10' 32 | 33 | - name: Loading cache 34 | uses: actions/cache@v4 35 | id: cache 36 | with: 37 | path: ~/.cache/pip 38 | key: v1-test_build_doc 39 | restore-keys: | 40 | v1-test_build_doc-${{ hashFiles('setup.py') }} 41 | v1-test_build_doc 42 | 43 | - name: Create and activate virtual environment 44 | run: | 45 | python -m venv venv 46 | source venv/bin/activate 47 | 48 | - name: Setup environment 49 | run: | 50 | cd doc-builder 51 | pip install . 52 | cd .. 53 | 54 | cd accelerate 55 | pip install .[dev] 56 | cd .. 57 | 58 | - name: Make documentation 59 | run: | 60 | cd doc-builder && 61 | doc-builder build accelerate ../accelerate/docs/source --build_dir ../build_dir --clean --html && 62 | cd .. 63 | env: 64 | NODE_OPTIONS: --max-old-space-size=6656 65 | -------------------------------------------------------------------------------- /.github/workflows/delete_old_pr_documentations.yml: -------------------------------------------------------------------------------- 1 | name: Delete old PRs docs 2 | on: 3 | workflow_dispatch: 4 | schedule: 5 | - cron: "11 11 * * *" 6 | 7 | defaults: 8 | run: 9 | working-directory: scripts 10 | 11 | jobs: 12 | delete_old_prs: 13 | runs-on: ubuntu-latest 14 | steps: 15 | - uses: actions/checkout@v4 16 | - uses: denoland/setup-deno@v1 17 | with: 18 | deno-version: v1.x 19 | - run: deno run --allow-env --allow-net --allow-run --allow-read ./delete-old-prs.ts 20 | env: 21 | HF_ACCESS_TOKEN: ${{ secrets.HF_ACCESS_TOKEN }} 22 | -------------------------------------------------------------------------------- /.github/workflows/lint-svelte-kit.yml: -------------------------------------------------------------------------------- 1 | name: SvelteKit Lint 2 | on: 3 | pull_request: 4 | paths: 5 | - "kit/**" 6 | - ".github/workflows/lint-svelte-kit.yml" 7 | push: 8 | branches: 9 | - main 10 | 11 | jobs: 12 | lint: 13 | runs-on: ubuntu-latest 14 | timeout-minutes: 10 15 | 16 | steps: 17 | - uses: actions/checkout@v4 18 | 19 | - uses: actions/setup-node@v4 20 | with: 21 | node-version: "20" 22 | 23 | - name: Install dependencies 24 | run: npm install ci 25 | working-directory: kit 26 | 27 | - name: Checking lint/format errors 28 | run: npm run lint 29 | working-directory: kit 30 | 31 | - name: Checking type errors 32 | run: npm run check 33 | working-directory: kit -------------------------------------------------------------------------------- /.github/workflows/quality.yml: -------------------------------------------------------------------------------- 1 | name: Quality Check 2 | 3 | on: [pull_request] 4 | 5 | jobs: 6 | quality: 7 | runs-on: ubuntu-latest 8 | steps: 9 | - uses: actions/checkout@v4 10 | - name: Set up Python 3.10 11 | uses: actions/setup-python@v5 12 | with: 13 | python-version: "3.10" 14 | - name: Install Python dependencies 15 | run: pip install -e .[quality] 16 | - name: Run Quality check 17 | run: make quality 18 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: Run Tests 2 | 3 | on: [pull_request] 4 | 5 | jobs: 6 | test: 7 | strategy: 8 | matrix: 9 | os: [ubuntu-latest, windows-latest] 10 | fail-fast: false 11 | runs-on: ${{ matrix.os }} 12 | steps: 13 | - uses: actions/checkout@v4 14 | - name: Set up Python 3.10 15 | uses: actions/setup-python@v5 16 | with: 17 | python-version: "3.10" 18 | - name: Install Python dependencies 19 | run: | 20 | pip install -e ".[all]" 21 | pip install git+https://github.com/huggingface/transformers 22 | - name: Run Tests 23 | run: python -m pytest -n 1 --dist=loadfile -s -v ./tests/ 24 | -------------------------------------------------------------------------------- /.github/workflows/upload_pr_documentation.yml: -------------------------------------------------------------------------------- 1 | name: Upload PR documentation 2 | 3 | on: 4 | workflow_call: 5 | inputs: 6 | package_name: 7 | required: true 8 | type: string 9 | hub_base_path: 10 | type: string 11 | repo_owner: 12 | type: string 13 | default: 'huggingface' 14 | description: "Owner of the repo to build documentation for. Defaults to 'huggingface'." 15 | secrets: 16 | hf_token: 17 | required: true 18 | comment_bot_token: 19 | required: true 20 | 21 | jobs: 22 | upload_pr_documentation: 23 | runs-on: ubuntu-22.04 24 | if: > 25 | (github.event.workflow_run.event == 'pull_request' || 26 | github.event.workflow_run.event == 'pull_request_target' || 27 | github.event.workflow_run.event == 'workflow_dispatch') && 28 | github.event.workflow_run.conclusion == 'success' 29 | 30 | steps: 31 | - uses: actions/checkout@v4 32 | with: 33 | repository: 'huggingface/doc-builder' 34 | path: doc-builder 35 | # Uncomment the following line to use a specific revision of doc-builder 36 | # ref: fix-corrupted-zip 37 | 38 | - name: Setup environment 39 | shell: bash 40 | id: setup-env 41 | run: | 42 | pip install black 43 | cd doc-builder 44 | pip install . 45 | cd .. 46 | echo "current_work_dir=$(pwd)" >> $GITHUB_OUTPUT 47 | 48 | - name: 'Download artifact' 49 | uses: actions/download-artifact@v4 50 | with: 51 | name: doc-build-artifact 52 | path: ${{ github.workspace }}/build_dir 53 | github-token: ${{ secrets.GITHUB_TOKEN }} 54 | run-id: ${{github.event.workflow_run.id }} 55 | 56 | - name: Display structure of downloaded files 57 | run: ls -l 58 | 59 | - name: Get commit_sha & pr_number 60 | id: github-context 61 | run: | 62 | content_commit_sha=$(cat ./build_dir/commit_sha) 63 | if [[ $content_commit_sha =~ ^[0-9a-zA-Z]{40}$ ]]; then 64 | echo "commit_sha=$content_commit_sha" >> $GITHUB_OUTPUT 65 | rm -rf ./build_dir/commit_sha 66 | else 67 | echo "Encountered an invalid commit_sha" 68 | exit 1 69 | fi 70 | 71 | content_pr_number=$(cat ./build_dir/pr_number) 72 | if [[ $content_pr_number =~ ^[0-9]+$ ]]; then 73 | echo "pr_number=$content_pr_number" >> $GITHUB_OUTPUT 74 | rm -rf ./build_dir/pr_number 75 | else 76 | echo "Encountered an invalid pr_number" 77 | exit 1 78 | fi 79 | 80 | - name: Set hub_docs_url 81 | id: hfhub-context 82 | run: | 83 | if [ -z "${{ inputs.hub_base_path }}" ] 84 | then 85 | echo "hub_docs_url=https://moon-ci-docs.huggingface.co/docs/${{ inputs.package_name }}/pr_${{ steps.github-context.outputs.pr_number }}" >> $GITHUB_OUTPUT 86 | echo "hub_base_path not provided, defaulting to https://moon-ci-docs.huggingface.co/docs" 87 | else 88 | echo "hub_docs_url=${{ inputs.hub_base_path }}/${{ inputs.package_name }}/pr_${{ steps.github-context.outputs.pr_number }}" >> $GITHUB_OUTPUT 89 | fi 90 | 91 | - name: Push to repositories 92 | shell: bash 93 | run: | 94 | cd build_dir 95 | doc-builder push ${{ inputs.package_name }} --doc_build_repo_id "hf-doc-build/doc-build-dev" --token "${{ secrets.hf_token }}" --commit_msg "Updated with commit ${{ steps.github-context.outputs.commit_sha }} See: https://github.com/${{ inputs.repo_owner }}/${{ inputs.package_name }}/commit/${{ steps.github-context.outputs.commit_sha }}" 96 | 97 | - name: Find doc comment 98 | uses: peter-evans/find-comment@v2 99 | id: find_comment 100 | with: 101 | issue-number: ${{ steps.github-context.outputs.pr_number }} 102 | body-includes: docs for this PR 103 | 104 | - name: Add doc comment if not present 105 | uses: thollander/actions-comment-pull-request@v2 106 | if: steps.find_comment.outputs.comment-id == '' 107 | 108 | with: 109 | message: 'The docs for this PR live [here](${{ steps.hfhub-context.outputs.hub_docs_url }}). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.' 110 | pr_number: ${{ steps.github-context.outputs.pr_number }} 111 | GITHUB_TOKEN: ${{ secrets.comment_bot_token }} 112 | 113 | - name: Update doc comment if necessary 114 | if: github.event.action == 'reopened' && steps.find_comment.outputs.comment-id != '' 115 | uses: peter-evans/create-or-update-comment@v1 116 | with: 117 | comment-id: ${{ steps.find_comment.outputs.comment-id }} 118 | token: ${{ secrets.comment_bot_token }} 119 | edit-mode: replace 120 | body: | 121 | The docs for this PR live [here](${{ steps.hfhub-context.outputs.hub_docs_url }}). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. 122 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # VSCode 7 | .vscode 8 | .env 9 | 10 | # PyCharm 11 | .idea 12 | 13 | # Build 14 | build 15 | dist 16 | src/hf_doc_builder.egg-info 17 | src/doc_builder.egg-info 18 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include kit/* 2 | recursive-include kit/src * -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: quality style test 2 | 3 | check_dirs := tests src 4 | 5 | # Make sure to install timm, pytest, transformers 6 | test: 7 | python -m pytest -n 1 --dist=loadfile -s -v ./tests/ 8 | 9 | 10 | doc: 11 | doc-builder build transformers ../transformers/docs/source/ 12 | 13 | quality: 14 | black --check $(check_dirs) 15 | isort --check-only $(check_dirs) 16 | flake8 $(check_dirs) 17 | 18 | style: 19 | black $(check_dirs) 20 | isort $(check_dirs) 21 | -------------------------------------------------------------------------------- /kit/.eslintignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /build 4 | /.svelte-kit 5 | /package 6 | .env 7 | .env.* 8 | !.env.example 9 | 10 | # Ignore files for PNPM, NPM and YARN 11 | pnpm-lock.yaml 12 | package-lock.json 13 | yarn.lock 14 | -------------------------------------------------------------------------------- /kit/.eslintrc.cjs: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | parser: "@typescript-eslint/parser", 4 | extends: [ 5 | "eslint:recommended", 6 | "plugin:@typescript-eslint/recommended", 7 | "plugin:svelte/recommended", 8 | "prettier", 9 | ], 10 | plugins: ["@typescript-eslint"], 11 | ignorePatterns: ["*.cjs"], 12 | overrides: [ 13 | { 14 | files: ["*.svelte"], 15 | parser: "svelte-eslint-parser", 16 | parserOptions: { 17 | parser: "@typescript-eslint/parser", 18 | }, 19 | }, 20 | ], 21 | parserOptions: { 22 | sourceType: "module", 23 | ecmaVersion: 2020, 24 | extraFileExtensions: [".svelte"], 25 | }, 26 | rules: { 27 | "no-shadow": ["error"], 28 | "@typescript-eslint/no-explicit-any": "error", 29 | "@typescript-eslint/no-non-null-assertion": "error", 30 | "@typescript-eslint/no-unused-vars": [ 31 | // prevent variables with a _ prefix from being marked as unused 32 | "error", 33 | { 34 | argsIgnorePattern: "^_", 35 | }, 36 | ], 37 | }, 38 | env: { 39 | browser: true, 40 | es2017: true, 41 | node: true, 42 | }, 43 | }; 44 | -------------------------------------------------------------------------------- /kit/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /build 4 | /.svelte-kit 5 | /package 6 | .env 7 | .env.* 8 | !.env.example 9 | 10 | # The src/routes folder will be where the unprocessed doc is pasted. 11 | src/routes 12 | 13 | vite.config.js.timestamp-* 14 | vite.config.ts.timestamp-* 15 | -------------------------------------------------------------------------------- /kit/.npmrc: -------------------------------------------------------------------------------- 1 | engine-strict=true 2 | resolution-mode=highest 3 | -------------------------------------------------------------------------------- /kit/.prettierignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /build 4 | /.svelte-kit 5 | /package 6 | .env 7 | .env.* 8 | !.env.example 9 | 10 | # Ignore files for PNPM, NPM and YARN 11 | pnpm-lock.yaml 12 | package-lock.json 13 | yarn.lock 14 | -------------------------------------------------------------------------------- /kit/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "useTabs": true, 3 | "trailingComma": "es5", 4 | "printWidth": 100, 5 | "plugins": ["prettier-plugin-svelte", "prettier-plugin-tailwindcss"], 6 | "overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }] 7 | } 8 | -------------------------------------------------------------------------------- /kit/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "kit", 3 | "version": "0.0.1", 4 | "private": true, 5 | "scripts": { 6 | "custom-svelte-client": "node ./svelteKitCustomClient/replace", 7 | "dev": "npm run custom-svelte-client && vite dev", 8 | "build": "npm run custom-svelte-client && rm -Rf src/routes/__pycache__ && vite build && node postprocess && ./postbuild.sh", 9 | "preview": "vite preview", 10 | "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", 11 | "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", 12 | "lint": "prettier --check --plugin prettier-plugin-svelte .", 13 | "format": "prettier --write --plugin prettier-plugin-svelte .", 14 | "update-inference-providers": "npm ci && npm i @huggingface/inference@latest && npm i @huggingface/tasks@latest" 15 | }, 16 | "devDependencies": { 17 | "@huggingface/inference": "^4.0.1", 18 | "@huggingface/tasks": "^0.19.11", 19 | "@sveltejs/adapter-auto": "^2.0.0", 20 | "@sveltejs/adapter-static": "^2.0.3", 21 | "@sveltejs/kit": "^1.20.4", 22 | "@tailwindcss/aspect-ratio": "^0.4.2", 23 | "@tailwindcss/forms": "^0.5.6", 24 | "@tailwindcss/typography": "^0.5.10", 25 | "@types/js-yaml": "^4.0.6", 26 | "@types/node": "^20.6.5", 27 | "@typescript-eslint/eslint-plugin": "^6.7.2", 28 | "autoprefixer": "^10.4.14", 29 | "cheerio": "^1.0.0-rc.12", 30 | "domutils": "^2.8.0", 31 | "eslint": "^8.50.0", 32 | "eslint-config-prettier": "^9.0.0", 33 | "eslint-plugin-svelte": "^2.33.2", 34 | "highlight.js": "^11.8.0", 35 | "html-tags": "^3.3.1", 36 | "htmlparser2": "^7.2.0", 37 | "js-yaml": "^4.1.0", 38 | "katex": "^0.16.8", 39 | "mdsvex": "^0.11.0", 40 | "postcss": "^8.4.24", 41 | "postcss-load-config": "^4.0.1", 42 | "prettier": "^3.0.3", 43 | "prettier-plugin-svelte": "^3.0.3", 44 | "prettier-plugin-tailwindcss": "^0.5.4", 45 | "svelte": "^4.0.5", 46 | "svelte-check": "^3.4.3", 47 | "tailwindcss": "^3.3.2", 48 | "tslib": "^2.4.1", 49 | "typescript": "^5.0.0", 50 | "unist-util-visit": "^5.0.0", 51 | "vite": "^4.4.2" 52 | }, 53 | "type": "module" 54 | } 55 | -------------------------------------------------------------------------------- /kit/postbuild.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -euo pipefail 3 | IFS=$'\n\t' 4 | 5 | cp src/routes/_toctree.yml build/_toctree.yml 6 | 7 | # Copy redirects yml file if exists 8 | if [ -e src/routes/_redirects.yml ] 9 | then cp src/routes/_redirects.yml build/_redirects.yml 10 | fi 11 | 12 | # make `rel="stylesheet"` -> `rel="modulepreload"` 13 | cd build 14 | find . -name '*.html' -exec perl -pi -e 's/rel="stylesheet"/rel="modulepreload"/g' {} + 15 | cd .. -------------------------------------------------------------------------------- /kit/postcss.config.cjs: -------------------------------------------------------------------------------- 1 | const tailwindcss = require("tailwindcss"); 2 | const autoprefixer = require("autoprefixer"); 3 | const postcss = require("postcss"); 4 | 5 | const removeAllCss = postcss.plugin("postcss-empty", () => { 6 | return (root) => { 7 | root.removeAll(); // This will remove all the nodes, effectively emptying the content. 8 | }; 9 | }); 10 | 11 | const plugins = [ 12 | //Some plugins, like tailwindcss/nesting, need to run before Tailwind, 13 | tailwindcss(), 14 | //But others, like autoprefixer, need to run after, 15 | autoprefixer, 16 | ]; 17 | 18 | // make the resulting CSS files empty during "build" process 19 | // to not conflict with the already existing hub tailwind 20 | if (process.argv.includes("build")) { 21 | plugins.push(removeAllCss); 22 | } 23 | 24 | const config = { plugins }; 25 | 26 | module.exports = config; 27 | -------------------------------------------------------------------------------- /kit/postprocess.js: -------------------------------------------------------------------------------- 1 | import fs from "fs"; 2 | import path from "path"; 3 | 4 | const directoryPath = "./build"; //build dir 5 | 6 | // Recursively read all HTML files in a directory 7 | function readFiles(directory) { 8 | const files = fs.readdirSync(directory); 9 | 10 | files.forEach((file) => { 11 | const filePath = path.join(directory, file); 12 | const stat = fs.statSync(filePath); 13 | 14 | if (stat.isDirectory()) { 15 | readFiles(filePath); 16 | } else if (filePath.endsWith(".html")) { 17 | processFile(filePath); 18 | } 19 | }); 20 | } 21 | 22 | // Regex to match `meta name="hf:doc:metadata"` 23 | const REGEX_HF_METADATA = /(.+)/s; 24 | 25 | function processFile(filePath) { 26 | // Read the file synchronously 27 | const data = fs.readFileSync(filePath, "utf8"); 28 | // Extract the matched group using the regex 29 | const match = data.match(REGEX_HF_METADATA); 30 | // Append macthed group 1 to the first line 31 | const lines = data.split("\n"); 32 | lines[0] += match[1]; 33 | // Join the lines back and write to the file synchronously 34 | const updatedData = lines.join("\n"); 35 | fs.writeFileSync(filePath, updatedData, "utf8"); 36 | } 37 | 38 | readFiles(directoryPath); 39 | -------------------------------------------------------------------------------- /kit/preprocessors/frameworkcontent.js: -------------------------------------------------------------------------------- 1 | import { replaceAsync, generateTagRegex } from "./utils.js"; 2 | 3 | // Preprocessor that converts markdown into FrameworkContent 4 | // svelte component using mdsvexPreprocess 5 | export const frameworkcontentPreprocess = { 6 | markup: async ({ content }) => { 7 | const REGEX_FRAMEWORKCONTENT = generateTagRegex("frameworkcontent", true); 8 | const REGEX_PYTORCH = generateTagRegex("pt"); 9 | const REGEX_TENSORFLOW = generateTagRegex("tf"); 10 | const REGEX_JAX = generateTagRegex("jax"); 11 | 12 | content = await replaceAsync(content, REGEX_FRAMEWORKCONTENT, async (_, fwcontentBody) => { 13 | const FRAMEWORKS = [ 14 | { framework: "pytorch", REGEX_FW: REGEX_PYTORCH, isExist: false }, 15 | { framework: "tensorflow", REGEX_FW: REGEX_TENSORFLOW, isExist: false }, 16 | { framework: "jax", REGEX_FW: REGEX_JAX, isExist: false }, 17 | ]; 18 | 19 | let svelteSlots = ""; 20 | 21 | for (const [i, value] of Object.entries(FRAMEWORKS)) { 22 | const { framework, REGEX_FW } = value; 23 | if (fwcontentBody.match(REGEX_FW)) { 24 | FRAMEWORKS[i].isExist = true; 25 | const fwContent = fwcontentBody.match(REGEX_FW)[1]; 26 | svelteSlots += ` 27 | 28 | \n\n${fwContent}\n\n 29 | 30 | `; 31 | } 32 | } 33 | 34 | const svelteProps = FRAMEWORKS.map((fw) => `${fw.framework}={${fw.isExist}}`).join(" "); 35 | 36 | return `\n\n\n${svelteSlots}\n\n\n`; 37 | }); 38 | 39 | return { code: content }; 40 | }, 41 | }; 42 | -------------------------------------------------------------------------------- /kit/preprocessors/hashInCode.js: -------------------------------------------------------------------------------- 1 | import { replaceAsync } from "./utils.js"; 2 | 3 | // Preprocessor that converts `#` char inside code/codeblocks into its html5 entity `&num;` 4 | // otherwise, an extra new space was being rendered 5 | export const hashInCodePreprocess = { 6 | markup: async ({ content }) => { 7 | const REGEX_CODE_BLOCK = /```.*?```/gs; 8 | const REGEX_INLINE_CODE = /`.*?`/g; 9 | const REGEX_INLINE_EXCEPTION = /(?!.*HF_DOC_BODY_START)`.*?`(? { 11 | return codeContent.replaceAll("#", "&num;"); 12 | }); 13 | content = await replaceAsync(content, REGEX_INLINE_CODE, async (codeContent) => { 14 | return codeContent.replaceAll("#", "&num;"); 15 | }); 16 | // Exception: we don't want to replace `#` in code blocks that are part of the doc body, as they may be hrefs 17 | content = await replaceAsync(content, REGEX_INLINE_EXCEPTION, async (codeContent) => { 18 | return codeContent.replaceAll("&num;", "#"); 19 | }); 20 | return { code: content }; 21 | }, 22 | }; 23 | -------------------------------------------------------------------------------- /kit/preprocessors/hfOptions.js: -------------------------------------------------------------------------------- 1 | import { replaceAsync, generateTagRegexWithId } from "./utils.js"; 2 | 3 | // Preprocessor that converts markdown into HfOptions 4 | // svelte component using mdsvexPreprocess 5 | export const hfOptionsPreprocess = { 6 | markup: async ({ content }) => { 7 | const REGEX_HF_OPTIONS = generateTagRegexWithId("hfoptions", true); 8 | const REGEX_HF_OPTION = generateTagRegexWithId("hfoption", true); 9 | content = await replaceAsync(content, REGEX_HF_OPTIONS, async (_, id, hfOptionsContent) => { 10 | const options = []; 11 | hfOptionsContent = await replaceAsync( 12 | hfOptionsContent, 13 | REGEX_HF_OPTION, 14 | async (__, option, hfOptionContent) => { 15 | options.push(option); 16 | return `\n\n${hfOptionContent}\n\n`; 17 | } 18 | ); 19 | return `\n${hfOptionsContent}\n`; 22 | }); 23 | return { code: content }; 24 | }, 25 | }; 26 | -------------------------------------------------------------------------------- /kit/preprocessors/index.js: -------------------------------------------------------------------------------- 1 | export { frameworkcontentPreprocess } from "./frameworkcontent.js"; 2 | export { docstringPreprocess } from "./docstring.js"; 3 | export { inferenceSnippetPreprocess } from "./inferenceSnippet.js"; 4 | export { tokenizersLangPreprocess } from "./tokenizersLang.js"; 5 | export { mdsvexPreprocess } from "./mdsvex/index.js"; 6 | export { hfOptionsPreprocess } from "./hfOptions.js"; 7 | export { hashInCodePreprocess } from "./hashInCode.js"; 8 | -------------------------------------------------------------------------------- /kit/preprocessors/inferenceSnippet.js: -------------------------------------------------------------------------------- 1 | import { replaceAsync, generateTagRegex } from "./utils.js"; 2 | 3 | // Preprocessor that converts markdown into InferenceApi 4 | // svelte component using mdsvexPreprocess 5 | export const inferenceSnippetPreprocess = { 6 | markup: async ({ content }) => { 7 | const REGEX_FRAMEWORKCONTENT = generateTagRegex("inferencesnippet", true); 8 | const REGEX_PYTHON = generateTagRegex("python"); 9 | const REGEX_JS = generateTagRegex("js"); 10 | const REGEX_CURL = generateTagRegex("curl"); 11 | const FRAMEWORKS = [ 12 | { framework: "python", REGEX_FW: REGEX_PYTHON, isExist: false }, 13 | { framework: "js", REGEX_FW: REGEX_JS, isExist: false }, 14 | { framework: "curl", REGEX_FW: REGEX_CURL, isExist: false }, 15 | ]; 16 | 17 | content = await replaceAsync(content, REGEX_FRAMEWORKCONTENT, async (_, fwcontentBody) => { 18 | let svelteSlots = ""; 19 | 20 | for (const [i, value] of Object.entries(FRAMEWORKS)) { 21 | const { framework, REGEX_FW } = value; 22 | if (fwcontentBody.match(REGEX_FW)) { 23 | FRAMEWORKS[i].isExist = true; 24 | const fwContent = fwcontentBody.match(REGEX_FW)[1]; 25 | svelteSlots += ` 26 | 27 | \n\n${fwContent}\n\n 28 | 29 | `; 30 | } 31 | } 32 | 33 | const svelteProps = FRAMEWORKS.map((fw) => `${fw.framework}={${fw.isExist}}`).join(" "); 34 | 35 | return `\n${svelteSlots}\n`; 36 | }); 37 | 38 | return { code: content }; 39 | }, 40 | }; 41 | -------------------------------------------------------------------------------- /kit/preprocessors/tokenizersLang.js: -------------------------------------------------------------------------------- 1 | import { replaceAsync, generateTagRegex } from "./utils.js"; 2 | 3 | // Preprocessor that converts markdown into TokenizersLanguageContent 4 | // svelte component using mdsvexPreprocess 5 | export const tokenizersLangPreprocess = { 6 | markup: async ({ content }) => { 7 | const REGEX_FRAMEWORKCONTENT = generateTagRegex("tokenizerslangcontent", true); 8 | const REGEX_PYTHON = generateTagRegex("python"); 9 | const RGEX_RUST = generateTagRegex("rust"); 10 | const REGEX_NODE = generateTagRegex("node"); 11 | const FRAMEWORKS = [ 12 | { framework: "python", REGEX_FW: REGEX_PYTHON, isExist: false }, 13 | { framework: "rust", REGEX_FW: RGEX_RUST, isExist: false }, 14 | { framework: "node", REGEX_FW: REGEX_NODE, isExist: false }, 15 | ]; 16 | 17 | content = await replaceAsync(content, REGEX_FRAMEWORKCONTENT, async (_, fwcontentBody) => { 18 | let svelteSlots = ""; 19 | 20 | for (const [i, value] of Object.entries(FRAMEWORKS)) { 21 | const { framework, REGEX_FW } = value; 22 | if (fwcontentBody.match(REGEX_FW)) { 23 | FRAMEWORKS[i].isExist = true; 24 | const fwContent = fwcontentBody.match(REGEX_FW)[1]; 25 | svelteSlots += ` 26 | 27 | \n\n${fwContent}\n\n 28 | 29 | `; 30 | } 31 | } 32 | 33 | const svelteProps = FRAMEWORKS.map((fw) => `${fw.framework}={${fw.isExist}}`).join(" "); 34 | 35 | return `\n${svelteSlots}\n`; 36 | }); 37 | 38 | return { code: content }; 39 | }, 40 | }; 41 | -------------------------------------------------------------------------------- /kit/preprocessors/utils.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Async string replace function. 3 | * src: https://github.com/dsblv/string-replace-async 4 | * @param {string} string 5 | * @param {RegExp} searchValue 6 | * @param {Function | string} replacer 7 | */ 8 | export async function replaceAsync(string, searchValue, replacer) { 9 | if (typeof replacer === "function") { 10 | // 1. Run fake pass of `replace`, collect values from `replacer` calls 11 | // 2. Resolve them with `Promise.all` 12 | // 3. Run `replace` with resolved values 13 | const values = []; 14 | String.prototype.replace.call(string, searchValue, function () { 15 | values.push(replacer.apply(undefined, arguments)); 16 | return ""; 17 | }); 18 | const resolvedValues = await Promise.all(values); 19 | return String.prototype.replace.call(string, searchValue, function () { 20 | return resolvedValues.shift(); 21 | }); 22 | } 23 | return String.prototype.replace.call(string, searchValue, replacer); 24 | } 25 | 26 | /** 27 | * Render escaped characters like `<`, `{`, '#'. 28 | * used for Doc 29 | * @param {string} code 30 | */ 31 | export function renderSvelteChars(code) { 32 | return code 33 | .replace(/&lcub;/g, "{") 34 | .replace(/&lt;/g, "<") 35 | .replace(/&num;/g, "#"); 36 | } 37 | 38 | /** 39 | * Create a regex that captures html-like opening and closing tag and its contents. 40 | * used for parsing hf custom syntax 41 | * example: generateTagRegex("inferenceSnippet", true) -> /(.*?)<\/inferenceSnippet>/msg 42 | * @param {string} tag - The name of the tag to match content within. 43 | * @param {boolean} [global=false] - Whether to create a global pattern that matches all occurrences. 44 | * @returns {RegExp} - The generated RegExp pattern. 45 | */ 46 | export function generateTagRegex(tag, global = false) { 47 | const flags = global ? "msg" : "ms"; 48 | const pattern = new RegExp(`<${tag}>(.*?)<\\/${tag}>`, flags); 49 | return pattern; 50 | } 51 | 52 | /** 53 | * Create a regex that captures html-like opening and closing tag with attribute "id" and its contents. 54 | * used for parsing hf custom syntax 55 | * example: generateTagRegex("inferenceSnippet", true) -> /(.*?)<\/inferenceSnippet>/msg 56 | * @param {string} tag - The name of the tag to match content within. 57 | * @param {boolean} [global=false] - Whether to create a global pattern that matches all occurrences. 58 | * @returns {RegExp} - The generated RegExp pattern. 59 | */ 60 | export function generateTagRegexWithId(tag, global = false) { 61 | const flags = global ? "msg" : "ms"; 62 | const pattern = new RegExp(`<${tag}\\s+id=["'](.+?)["']\\s*>(.*?)<\\/${tag}>`, flags); 63 | return pattern; 64 | } 65 | -------------------------------------------------------------------------------- /kit/src/app.d.ts: -------------------------------------------------------------------------------- 1 | // See https://kit.svelte.dev/docs/types#app 2 | // for information about these interfaces 3 | declare global { 4 | namespace App { 5 | // interface Error {} 6 | // interface Locals {} 7 | // interface PageData {} 8 | // interface Platform {} 9 | } 10 | } 11 | 12 | export {}; 13 | -------------------------------------------------------------------------------- /kit/src/app.html: -------------------------------------------------------------------------------- 1 | %sveltekit.head% %sveltekit.body% 2 | -------------------------------------------------------------------------------- /kit/src/lib/Added.svelte: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 |

Added in {version}

9 | 10 |
11 | -------------------------------------------------------------------------------- /kit/src/lib/Changed.svelte: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 |

Changed in {version}

9 | 10 |
11 | -------------------------------------------------------------------------------- /kit/src/lib/CodeBlock.svelte: -------------------------------------------------------------------------------- 1 | 16 | 17 |
24 |
25 | 30 |
31 |
{@html highlighted}
32 |
33 | -------------------------------------------------------------------------------- /kit/src/lib/CodeBlockFw.svelte: -------------------------------------------------------------------------------- 1 | 23 | 24 |
31 | {#if $group === "group1"} 32 |
33 | 38 |
39 |
{@html group1.highlighted}
42 | {:else} 43 |
44 | 49 |
50 |
{@html group2.highlighted}
53 | {/if} 54 |
55 | -------------------------------------------------------------------------------- /kit/src/lib/ColabDropdown.svelte: -------------------------------------------------------------------------------- 1 | 12 | 13 |
14 | 15 | 16 | Open In Colab 21 | 22 | 23 | {#each options as { label, value }} 24 | onClick(value)} 29 | useDeprecatedJS={false} 30 | /> 31 | {/each} 32 | 33 | 34 |
35 | -------------------------------------------------------------------------------- /kit/src/lib/CopyButton.svelte: -------------------------------------------------------------------------------- 1 | 34 | 35 | 51 | -------------------------------------------------------------------------------- /kit/src/lib/CourseFloatingBanner.svelte: -------------------------------------------------------------------------------- 1 | 9 | 10 | 11 | 12 | 13 | Ask a Question 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /kit/src/lib/Deprecated.svelte: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 |

Deprecated in {version}

9 | 10 |
11 | -------------------------------------------------------------------------------- /kit/src/lib/DocNotebookDropdown.svelte: -------------------------------------------------------------------------------- 1 | 49 | 50 | 51 | 52 |
53 | 54 | {#if googleColabOptions.length === 1} 55 | 56 | Open In Colab 61 | 62 | {:else if googleColabOptions.length > 1} 63 | 64 | 65 | Open In Colab 70 | 71 | 72 | {#each googleColabOptions as { label, value }} 73 | onClick(value)} 78 | useDeprecatedJS={false} 79 | /> 80 | {/each} 81 | 82 | 83 | {/if} 84 | {#if awsStudioOptions.length === 1} 85 | 86 | Open In Studio Lab 91 | 92 | {:else if awsStudioOptions.length > 1} 93 | 94 | 95 | Open In Studio Lab 100 | 101 | 102 | {#each awsStudioOptions as { label, value }} 103 | onClick(value)} 108 | useDeprecatedJS={false} 109 | /> 110 | {/each} 111 | 112 | 113 | {/if} 114 |
115 | -------------------------------------------------------------------------------- /kit/src/lib/Dropdown.svelte: -------------------------------------------------------------------------------- 1 | 30 | 31 |
32 | 33 | 54 | 55 | 56 | {#if isOpen || useDeprecatedJS} 57 | 63 | 64 | 65 | {/if} 66 | 67 |
68 | -------------------------------------------------------------------------------- /kit/src/lib/DropdownEntry.svelte: -------------------------------------------------------------------------------- 1 | 18 | 19 |
  • 20 | 33 | 34 | {#if $$slots.default} 35 | 36 | {:else} 37 | {#if icon} 38 | 39 | {/if} 40 | {label} 41 | {/if} 42 | 43 |
  • 44 | -------------------------------------------------------------------------------- /kit/src/lib/DropdownMenu.svelte: -------------------------------------------------------------------------------- 1 | 41 | 42 |
    49 |
      50 | 51 |
    52 |
    53 | -------------------------------------------------------------------------------- /kit/src/lib/EditOnGithub.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 | 10 | < 11 | > 12 | Update on GitHub 13 | 14 | -------------------------------------------------------------------------------- /kit/src/lib/ExampleCodeBlock.svelte: -------------------------------------------------------------------------------- 1 | 27 | 28 | 29 | 30 |
    31 | 36 | 37 | 38 | 39 |
    40 | -------------------------------------------------------------------------------- /kit/src/lib/FrameworkContent.svelte: -------------------------------------------------------------------------------- 1 | 7 | 8 |
    9 | {#if pytorch} 10 | 11 | 12 | 13 | {/if} 14 | {#if tensorflow} 15 | 16 | 17 | 18 | {/if} 19 | {#if jax} 20 | 21 | 22 | 23 | {/if} 24 |
    25 | -------------------------------------------------------------------------------- /kit/src/lib/FrameworkContentBlock.svelte: -------------------------------------------------------------------------------- 1 | 66 | 67 | 68 | 69 |
    70 |
    71 |
    72 | 73 | {label} 74 |
    75 | {#if !isClosed} 76 |
    80 | 81 | Hide {label} content 82 |
    83 | {/if} 84 |
    85 | {#if isClosed} 86 |
    90 | 91 | Show {label} content 92 |
    93 | {:else} 94 |
    95 | 96 |
    97 | {/if} 98 |
    99 | -------------------------------------------------------------------------------- /kit/src/lib/FrameworkSwitch.svelte: -------------------------------------------------------------------------------- 1 | 44 | 45 |
    46 |
    49 | {#each GROUPS.filter((g) => ids.includes(g.id)) as g, i} 50 | 63 | {/each} 64 |
    65 |
    66 | -------------------------------------------------------------------------------- /kit/src/lib/FrameworkSwitchCourse.svelte: -------------------------------------------------------------------------------- 1 | 24 | 25 |
    26 | {#each FRAMEWORKS as f, i} 27 | 33 | 34 | {f.name} 35 | 36 | {/each} 37 |
    38 | -------------------------------------------------------------------------------- /kit/src/lib/Heading.svelte: -------------------------------------------------------------------------------- 1 | 8 | 9 | 13 | 14 | {#if headingTag === "h1"} 15 |

    16 | {title} 21 |

    22 | {:else if headingTag === "h2"} 23 |

    24 | {title} 29 |

    30 | {:else if headingTag === "h3"} 31 |

    32 | {title} 37 |

    38 | {:else if headingTag === "h4"} 39 |

    40 | {title} 45 |

    46 | {:else if headingTag === "h5"} 47 |
    48 | {title} 53 |
    54 | {:else} 55 |
    56 | {title} 61 |
    62 | {/if} 63 | -------------------------------------------------------------------------------- /kit/src/lib/HfOption.svelte: -------------------------------------------------------------------------------- 1 | 7 | 8 | {#if $selectedHfOptions[id] === option} 9 | 10 | {/if} 11 | -------------------------------------------------------------------------------- /kit/src/lib/HfOptions.svelte: -------------------------------------------------------------------------------- 1 | 23 | 24 |
    25 | {#each options as option} 26 |
    updateSelectedOption(option)} 32 | > 33 | {option} 34 |
    35 | {/each} 36 |
    37 | 38 |
    39 | 40 |
    41 | -------------------------------------------------------------------------------- /kit/src/lib/IconCaretDown.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 | 20 | -------------------------------------------------------------------------------- /kit/src/lib/IconCopy.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 | 27 | -------------------------------------------------------------------------------- /kit/src/lib/IconCopyLink.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 | 20 | -------------------------------------------------------------------------------- /kit/src/lib/IconCurl.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 | 23 | -------------------------------------------------------------------------------- /kit/src/lib/IconEyeHide.svelte: -------------------------------------------------------------------------------- 1 | 5 | 6 | 14 | 18 | 19 | -------------------------------------------------------------------------------- /kit/src/lib/IconEyeShow.svelte: -------------------------------------------------------------------------------- 1 | 5 | 6 | 14 | 18 | 19 | -------------------------------------------------------------------------------- /kit/src/lib/IconJax.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 | 75 | -------------------------------------------------------------------------------- /kit/src/lib/IconJs.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 | 22 | -------------------------------------------------------------------------------- /kit/src/lib/IconNode.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 | 20 | -------------------------------------------------------------------------------- /kit/src/lib/IconPython.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 | 26 | -------------------------------------------------------------------------------- /kit/src/lib/IconPytorch.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 | 29 | -------------------------------------------------------------------------------- /kit/src/lib/IconRust.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 | 22 | -------------------------------------------------------------------------------- /kit/src/lib/IconTensorflow.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 | 30 | -------------------------------------------------------------------------------- /kit/src/lib/InferenceApi.svelte: -------------------------------------------------------------------------------- 1 | 52 | 53 |
    54 | {#each LANGUAGES_CONFIG.filter((c) => snippetExists[c.id]) as language} 55 |
    updateSelectedOption(language.id)} 61 | > 62 | 63 | {language.label} 64 |
    65 | {/each} 66 |
    67 |
    68 | {#if python && $selectedInferenceLang === "python"} 69 | 70 | {/if} 71 | {#if js && $selectedInferenceLang === "js"} 72 | 73 | {/if} 74 | {#if curl && $selectedInferenceLang === "curl"} 75 | 76 | {/if} 77 |
    78 | -------------------------------------------------------------------------------- /kit/src/lib/InferenceSnippet/IconInferenceBlackForest.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 | 26 | -------------------------------------------------------------------------------- /kit/src/lib/InferenceSnippet/IconInferenceCerebras.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 | 25 | -------------------------------------------------------------------------------- /kit/src/lib/InferenceSnippet/IconInferenceCohere.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 | 35 | -------------------------------------------------------------------------------- /kit/src/lib/InferenceSnippet/IconInferenceFal.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 | 24 | -------------------------------------------------------------------------------- /kit/src/lib/InferenceSnippet/IconInferenceFeatherless.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 | 25 | -------------------------------------------------------------------------------- /kit/src/lib/InferenceSnippet/IconInferenceFireworks.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 | 28 | -------------------------------------------------------------------------------- /kit/src/lib/InferenceSnippet/IconInferenceGroq.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 | 23 | -------------------------------------------------------------------------------- /kit/src/lib/InferenceSnippet/IconInferenceHf.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 | 34 | -------------------------------------------------------------------------------- /kit/src/lib/InferenceSnippet/IconInferenceHyperbolic.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 | 38 | -------------------------------------------------------------------------------- /kit/src/lib/InferenceSnippet/IconInferenceNebius.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 | 25 | -------------------------------------------------------------------------------- /kit/src/lib/InferenceSnippet/IconInferenceNovita.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 | 24 | -------------------------------------------------------------------------------- /kit/src/lib/InferenceSnippet/IconInferenceNscale.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 | 33 | -------------------------------------------------------------------------------- /kit/src/lib/InferenceSnippet/IconInferenceReplicate.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 | 46 | -------------------------------------------------------------------------------- /kit/src/lib/InferenceSnippet/IconInferenceSambaNova.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 | 30 | -------------------------------------------------------------------------------- /kit/src/lib/InferenceSnippet/IconInferenceTogetherAI.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 | 39 | -------------------------------------------------------------------------------- /kit/src/lib/InferenceSnippet/IconLinkExternal.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 | 32 | -------------------------------------------------------------------------------- /kit/src/lib/InferenceSnippet/IconSettings.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 | 22 | -------------------------------------------------------------------------------- /kit/src/lib/Markdown.svelte: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /kit/src/lib/PipelineIcon.svelte: -------------------------------------------------------------------------------- 1 | 79 | 80 | 84 | -------------------------------------------------------------------------------- /kit/src/lib/PipelineIcons/IconAudioClassification.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 | 22 | -------------------------------------------------------------------------------- /kit/src/lib/PipelineIcons/IconAudioToAudio.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 | 24 | -------------------------------------------------------------------------------- /kit/src/lib/PipelineIcons/IconAutomaticSpeechRecognition.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 | 24 | -------------------------------------------------------------------------------- /kit/src/lib/PipelineIcons/IconConversational.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 | 24 | -------------------------------------------------------------------------------- /kit/src/lib/PipelineIcons/IconDocumentQuestionAnswering.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 | 14 | -------------------------------------------------------------------------------- /kit/src/lib/PipelineIcons/IconFeatureExtraction.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 | 22 | -------------------------------------------------------------------------------- /kit/src/lib/PipelineIcons/IconFillMask.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 | 28 | -------------------------------------------------------------------------------- /kit/src/lib/PipelineIcons/IconImageClassification.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 | 24 | -------------------------------------------------------------------------------- /kit/src/lib/PipelineIcons/IconImageSegmentation.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 | 25 | -------------------------------------------------------------------------------- /kit/src/lib/PipelineIcons/IconImageToImage.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 | 26 | -------------------------------------------------------------------------------- /kit/src/lib/PipelineIcons/IconImageToText.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 | ​ 6 | 30 | -------------------------------------------------------------------------------- /kit/src/lib/PipelineIcons/IconObjectDetection.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 | 28 | -------------------------------------------------------------------------------- /kit/src/lib/PipelineIcons/IconQuestionAnswering.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 | 14 | 15 | 16 | 17 | 21 | 22 | -------------------------------------------------------------------------------- /kit/src/lib/PipelineIcons/IconReinforcementLearning.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 | 24 | -------------------------------------------------------------------------------- /kit/src/lib/PipelineIcons/IconRobotics.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 | 23 | -------------------------------------------------------------------------------- /kit/src/lib/PipelineIcons/IconSentenceSimilarity.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 | 28 | -------------------------------------------------------------------------------- /kit/src/lib/PipelineIcons/IconSummarization.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 | 25 | -------------------------------------------------------------------------------- /kit/src/lib/PipelineIcons/IconTableQuestionAnswering.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 | 22 | -------------------------------------------------------------------------------- /kit/src/lib/PipelineIcons/IconTabularClassification.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 | 23 | -------------------------------------------------------------------------------- /kit/src/lib/PipelineIcons/IconTabularRegression.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 | 21 | -------------------------------------------------------------------------------- /kit/src/lib/PipelineIcons/IconText2textGeneration.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 | 28 | -------------------------------------------------------------------------------- /kit/src/lib/PipelineIcons/IconTextClassification.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 | 34 | -------------------------------------------------------------------------------- /kit/src/lib/PipelineIcons/IconTextGeneration.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 | 26 | -------------------------------------------------------------------------------- /kit/src/lib/PipelineIcons/IconTextToImage.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 | 26 | -------------------------------------------------------------------------------- /kit/src/lib/PipelineIcons/IconTextToSpeech.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 | 24 | -------------------------------------------------------------------------------- /kit/src/lib/PipelineIcons/IconTokenClassification.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 | 34 | -------------------------------------------------------------------------------- /kit/src/lib/PipelineIcons/IconTranslation.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 | 25 | -------------------------------------------------------------------------------- /kit/src/lib/PipelineIcons/IconUnconditionalImageGeneration.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 | 26 | -------------------------------------------------------------------------------- /kit/src/lib/PipelineIcons/IconVoiceActivityDetection.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 | 24 | -------------------------------------------------------------------------------- /kit/src/lib/PipelineIcons/IconZeroShotClassification.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 | 52 | -------------------------------------------------------------------------------- /kit/src/lib/PipelineTag.svelte: -------------------------------------------------------------------------------- 1 | 8 | 9 |
    10 | 11 | 12 | {PIPELINE_DATA[pipeline].name ?? pipeline} 13 | 14 |
    15 | -------------------------------------------------------------------------------- /kit/src/lib/Question.svelte: -------------------------------------------------------------------------------- 1 | 55 | 56 |
    57 |
    checkAnswer()}> 58 | {#each choices as choice, index} 59 | 70 | {#if submitted && submitted.includes(index)} 71 |
    74 | 75 | {!!choice.correct ? "Correct!" : "Incorrect."} 76 | 77 | {@html choice.explain} 78 |
    79 | {/if} 80 | {/each} 81 |
    82 | 83 | 84 | {#if submitted.length} 85 |
    86 | {#if isFalse} 87 | 88 | Looks like at least one of your answers is wrong, try again! 89 | 90 | {:else if isIncomplete} 91 | 92 | You didn't select all the correct answers, there's more! 93 | 94 | {:else} 95 | You got all the answers! 96 | {/if} 97 |
    98 | {/if} 99 |
    100 |
    101 |
    102 | -------------------------------------------------------------------------------- /kit/src/lib/Tip.svelte: -------------------------------------------------------------------------------- 1 | 5 | 6 | 10 | 11 |
    16 | 17 |
    18 | -------------------------------------------------------------------------------- /kit/src/lib/TokenizersLanguageContent.svelte: -------------------------------------------------------------------------------- 1 | 50 | 51 |
    52 | {#each LANGUAGES_CONFIG as language} 53 |
    updateSelectedOption(language.id)} 59 | > 60 | 61 | {language.label} 62 |
    63 | {/each} 64 |
    65 |
    66 | {#if python && $selectedTokenizersLang === "python"} 67 | 68 | {/if} 69 | {#if rust && $selectedTokenizersLang === "rust"} 70 | 71 | {/if} 72 | {#if node && $selectedTokenizersLang === "node"} 73 | 74 | {/if} 75 |
    76 | -------------------------------------------------------------------------------- /kit/src/lib/Tooltip.svelte: -------------------------------------------------------------------------------- 1 | 6 | 7 |
    14 | 23 | -------------------------------------------------------------------------------- /kit/src/lib/TooltipFromAction.svelte: -------------------------------------------------------------------------------- 1 | 7 | 8 | {#if txt} 9 |
    19 | {@html txt} 20 |
    21 | {/if} 22 | -------------------------------------------------------------------------------- /kit/src/lib/Youtube.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 |