Skip to content

Commit

Permalink
Documentation improvements (#299)
Browse files Browse the repository at this point in the history
* Add link to optimum docs for supported architectures

Closes #288

* Refactor `SUPPORTED_MODELS` dict to include task

* Update example model id

* Update list of supported models

* Update generate_tests.py

* Remove requirement of `output_attentions` revision

* Add demo site to examples section (closes #233)

* Fix typo

* Include examples in docs index

* Update github issue templates

* Create config.yml

* Order supported models

* Cleanup

* Update 4_feature-request.yml
  • Loading branch information
xenova authored Dec 6, 2023
1 parent 5748774 commit 9a8c664
Show file tree
Hide file tree
Showing 17 changed files with 879 additions and 570 deletions.
40 changes: 0 additions & 40 deletions .github/ISSUE_TEMPLATE/1_bug-report.md

This file was deleted.

51 changes: 51 additions & 0 deletions .github/ISSUE_TEMPLATE/1_bug-report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: "🐛 Bug Report"
description: Submit a bug report to help us improve transformers.js
labels: [ "bug" ]
body:
- type: textarea
id: system-info
attributes:
label: System Info
description: Please share your system info with us. If you are using other JS libraries/frameworks (e.g., React or Next.js), please include their versions too.
placeholder: transformers.js version, browser (if applicable), operating system, Node.js version, bundlers, ...
validations:
required: true

- type: checkboxes
id: environment
attributes:
label: Environment
description: "The environment I am running in:"
options:
- label: "Website/web-app"
- label: "Browser extension"
- label: "Server-side (e.g., Node.js, Deno, Bun)"
- label: "Desktop app (e.g., Electron)"
- label: "Other (e.g., VSCode extension)"

- type: textarea
id: description
validations:
required: true
attributes:
label: Description
description: A clear and concise description of the bug, as well as what you expected to happen.

- type: textarea
id: reproduction
validations:
required: true
attributes:
label: Reproduction
description: |
Please provide a code sample that reproduces the problem you ran into.
If you have code snippets, error messages, stack traces please provide them here as well.
Important! Use [code tags](https://help.github.com/en/github/writing-on-github/creating-and-highlighting-code-blocks#syntax-highlighting) to correctly format your code.
placeholder: |
Steps to reproduce the behavior:
1.
2.
3.
26 changes: 0 additions & 26 deletions .github/ISSUE_TEMPLATE/2_feature-request.md

This file was deleted.

40 changes: 40 additions & 0 deletions .github/ISSUE_TEMPLATE/2_new_model.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: "🌟 New model addition"
description: Submit a proposal/request to implement a new model
labels: [ "New model" ]

body:
- type: textarea
id: description-request
validations:
required: true
attributes:
label: Model description
description: |
Include important information about the model.
- type: checkboxes
id: information-tasks
attributes:
label: Prerequisites
description: |
Please note that Transformers.js relies on the model first being supported in [🤗 Transformers](https://github.com/huggingface/transformers) and [🤗 Optimum](https://github.com/huggingface/optimum). If the model you are requesting is not yet supported by either of them, feel free to open up a model request there too.
options:
- label: "The model is supported in Transformers (i.e., listed [here](https://huggingface.co/docs/transformers/index#supported-models-and-frameworks))"
- label: "The model can be exported to ONNX with Optimum (i.e., listed [here](https://huggingface.co/docs/optimum/main/en/exporters/onnx/overview))"

- type: textarea
id: additional-info
attributes:
label: Additional information
description: |
Please provide additional information about the model here.
If the model is already supported in Transformers, you can provide example Python code to help ensure the JavaScript implementation (and output) matches the original version.
- type: textarea
id: contribution
validations:
required: true
attributes:
label: Your contribution
description: |
Is there any way that you could help, e.g. by submitting a PR?
40 changes: 40 additions & 0 deletions .github/ISSUE_TEMPLATE/3_new_pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: "🔧 New pipeline addition"
description: Submit a proposal/request to implement a new pipeline
labels: [ "New pipeline" ]

body:
- type: textarea
id: description-request
validations:
required: true
attributes:
label: Pipeline description
description: |
Put any and all important information related to the pipeline.
- type: checkboxes
id: information-tasks
attributes:
label: Prerequisites
description: |
Please note that Transformers.js relies on the pipeline first being supported in [🤗 Transformers](https://github.com/huggingface/transformers). If the pipeline you are requesting is not yet supported by Transformers, feel free to open up a feature request for it there too.
options:
- label: "The pipeline is supported in Transformers (i.e., listed [here](https://huggingface.co/docs/transformers/main_classes/pipelines))"
- label: "The task is listed [here](https://huggingface.co/tasks)"

- type: textarea
id: additional-info
attributes:
label: Additional information
description: |
Please provide additional information about the pipeline here.
If the pipeline is already supported in Transformers, you can provide example Python code to help ensure the JavaScript implementation (and output) matches the original version.
- type: textarea
id: contribution
validations:
required: true
attributes:
label: Your contribution
description: |
Is there any way that you could help, e.g. by submitting a PR?
10 changes: 0 additions & 10 deletions .github/ISSUE_TEMPLATE/3_question.md

This file was deleted.

31 changes: 31 additions & 0 deletions .github/ISSUE_TEMPLATE/4_feature-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: "🚀 Feature request"
description: Submit a proposal/request for a new transformers.js feature
labels: [ "feature" ]
body:
- type: textarea
id: feature-request
validations:
required: true
attributes:
label: Feature request
description: |
A clear and concise description of the feature proposal.
If the feature is already part of the python [Transformers](https://github.com/huggingface/transformers) library, please provide relevant links or example usage.
- type: textarea
id: motivation
validations:
required: true
attributes:
label: Motivation
description: |
Please outline the motivation for the proposal. Why is it important that we add this feature? What is your intended use case?
- type: textarea
id: contribution
validations:
required: true
attributes:
label: Your contribution
description: |
Is there any way that you could help, e.g. by submitting a PR?
13 changes: 13 additions & 0 deletions .github/ISSUE_TEMPLATE/5_question.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: "🙋 Question"
description: Ask a question about the library
labels: [ "question" ]

body:
- type: textarea
id: question
validations:
required: true
attributes:
label: Question
description: |
Please enter your question here...
9 changes: 9 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
blank_issues_enabled: true
version: 2.1
contact_links:
- name: Models on the Hugging Face Hub
url: https://huggingface.co/models?library=transformers.js
about: Open a Pull request / Discussion related to a specific model checkpoint directly on the Hugging Face Hub
- name: Documentation
url: https://huggingface.co/docs/transformers.js
about: View the Transformers.js documentation
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ let out = await pipe('I love transformers!');
You can also use a different model by specifying the model id or path as the second argument to the `pipeline` function. For example:
```javascript
// Use a different model for sentiment-analysis
let pipe = await pipeline('sentiment-analysis', 'nlptown/bert-base-multilingual-uncased-sentiment');
let pipe = await pipeline('sentiment-analysis', 'Xenova/bert-base-multilingual-uncased-sentiment');
```


Expand Down Expand Up @@ -125,6 +125,8 @@ Want to jump straight in? Get started with one of our sample applications/templa
| Next.js (client-side) | Sentiment analysis (in-browser inference) | [code](./examples/next-client/), [demo](https://huggingface.co/spaces/Xenova/next-example-app) |
| Next.js (server-side) | Sentiment analysis (Node.js inference) | [code](./examples/next-server/), [demo](https://huggingface.co/spaces/Xenova/next-server-example-app) |
| Node.js | Sentiment analysis API | [code](./examples/node/) |
| Demo site | A collection of demos | [code](./examples/demo-site/), [demo](https://xenova.github.io/transformers.js/) |



## Custom usage
Expand Down Expand Up @@ -176,6 +178,8 @@ bert-base-uncased/
└── model_quantized.onnx
```

For the full list of supported architectures, see the [Optimum documentation](https://huggingface.co/docs/optimum/main/en/exporters/onnx/overview).


## Supported tasks/models

Expand Down
2 changes: 1 addition & 1 deletion docs/snippets/1_quick-tour.snippet
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@ let out = await pipe('I love transformers!');
You can also use a different model by specifying the model id or path as the second argument to the `pipeline` function. For example:
```javascript
// Use a different model for sentiment-analysis
let pipe = await pipeline('sentiment-analysis', 'nlptown/bert-base-multilingual-uncased-sentiment');
let pipe = await pipeline('sentiment-analysis', 'Xenova/bert-base-multilingual-uncased-sentiment');
```
2 changes: 2 additions & 0 deletions docs/snippets/3_examples.snippet
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ Want to jump straight in? Get started with one of our sample applications/templa
| Next.js (client-side) | Sentiment analysis (in-browser inference) | [code](./examples/next-client/), [demo](https://huggingface.co/spaces/Xenova/next-example-app) |
| Next.js (server-side) | Sentiment analysis (Node.js inference) | [code](./examples/next-server/), [demo](https://huggingface.co/spaces/Xenova/next-server-example-app) |
| Node.js | Sentiment analysis API | [code](./examples/node/) |
| Demo site | A collection of demos | [code](./examples/demo-site/), [demo](https://xenova.github.io/transformers.js/) |

2 changes: 2 additions & 0 deletions docs/snippets/4_custom-usage.snippet
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,5 @@ bert-base-uncased/
├── model.onnx
└── model_quantized.onnx
```

For the full list of supported architectures, see the [Optimum documentation](https://huggingface.co/docs/optimum/main/en/exporters/onnx/overview).
8 changes: 8 additions & 0 deletions docs/source/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ The documentation is organized into 4 sections:
3. **DEVELOPER GUIDES** show you how to use the library to achieve a specific goal.
4. **API REFERENCE** describes all classes and functions, as well as their available parameters and types.

## Examples

<include>
{
"path": "../snippets/3_examples.snippet"
}
</include>

## Supported tasks/models

Here is the list of all tasks and architectures currently supported by Transformers.js.
Expand Down
Loading

0 comments on commit 9a8c664

Please sign in to comment.