Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade pydoc-markdown #2117

Merged
merged 60 commits into from
Feb 4, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
fea2198
Upgrade pydoc-markdown and fix the YAMLs to work with it
ZanSara Feb 2, 2022
935ef42
Add latest docstring and tutorial changes
github-actions[bot] Feb 2, 2022
efcf56a
Pin pydoc-markdown to major version
ZanSara Feb 3, 2022
5f9bbb9
Add quotes
ZanSara Feb 3, 2022
3316ffa
Restore proper arguments rendering
ZanSara Feb 3, 2022
f922cb5
Add latest docstring and tutorial changes
github-actions[bot] Feb 3, 2022
c97148a
Reintroduce crossref too
ZanSara Feb 3, 2022
bcb39e4
Merge branch 'upgrade-pydoc-markdown' of github.com:deepset-ai/haysta…
ZanSara Feb 3, 2022
8db6e46
Generalize pydoc-markdown workflow
ZanSara Feb 3, 2022
bb7247f
Fix some wrongly formatted return docstrings
ZanSara Feb 3, 2022
308d7ae
Fix some wrongly formatted parameter names
ZanSara Feb 3, 2022
cfaaf04
Add latest docstring and tutorial changes
github-actions[bot] Feb 3, 2022
687b855
Trigger a new workflow
ZanSara Feb 3, 2022
2946e09
Remane workflow
ZanSara Feb 3, 2022
d3373d2
Merge branch 'upgrade-pydoc-markdown' of github.com:deepset-ai/haysta…
ZanSara Feb 3, 2022
f5dbbc0
Merge branch 'master' into upgrade-pydoc-markdown
ZanSara Feb 3, 2022
149ed30
Make a single Action to perform all tasks that require committing int…
ZanSara Feb 3, 2022
8489b00
Add one file to recreate docs/_scr/api/api
ZanSara Feb 3, 2022
302cb40
Update Documentation
github-actions[bot] Feb 3, 2022
b8d2740
Merge the code updates and the docs in the Linux CI to prevent the bo…
ZanSara Feb 3, 2022
7bfcce3
Merge branch 'upgrade-pydoc-markdown' of github.com:deepset-ai/haysta…
ZanSara Feb 3, 2022
4ab8516
Installing Jupyter deps for Black
ZanSara Feb 3, 2022
1e61ea9
Add some comments to understand CI failure
ZanSara Feb 3, 2022
cb5d282
Try disabling fetch-depth
ZanSara Feb 3, 2022
7bcc925
Remove redundant trigger
ZanSara Feb 3, 2022
495825a
-> Update Documentation
github-actions[bot] Feb 3, 2022
4046e45
Build cache before running generation tasks
ZanSara Feb 4, 2022
60f96a4
Merge branch 'upgrade-pydoc-markdown' of github.com:deepset-ai/haysta…
ZanSara Feb 4, 2022
52f3ed5
Merge branch 'master' into upgrade-pydoc-markdown
ZanSara Feb 4, 2022
4c8e0d5
Fix dependency among tasks
ZanSara Feb 4, 2022
85776ea
Update Documentation
github-actions[bot] Feb 4, 2022
11c7b92
Final tweaks to Linux CI
ZanSara Feb 4, 2022
d9e2121
Merge branch 'upgrade-pydoc-markdown' of github.com:deepset-ai/haysta…
ZanSara Feb 4, 2022
bbc555e
Change trigger for Linux CI
ZanSara Feb 4, 2022
0dd863b
Change trigger for Linux CI
ZanSara Feb 4, 2022
3e5280b
Testing trigger
ZanSara Feb 4, 2022
2cfaa27
Change trigger for Linux CI
ZanSara Feb 4, 2022
f13c3e0
Add check not to run the code generation on master
ZanSara Feb 4, 2022
84ac0b6
Fix typo in Linux CI
ZanSara Feb 4, 2022
9ec55f7
Simplify push action
ZanSara Feb 4, 2022
c13e503
Make cache stick a bit longer and try pushing to head_ref
ZanSara Feb 4, 2022
5bdaefb
Typo in cache key
ZanSara Feb 4, 2022
adaa52e
Move commit & push together
ZanSara Feb 4, 2022
6acae9e
Simplify push command
ZanSara Feb 4, 2022
d751869
Persist credentials
ZanSara Feb 4, 2022
ef54e0e
Add more test deps in setup.cfg and remove from GH Action workflow
ZanSara Feb 4, 2022
3587d28
Trying to set the ref explicitly
ZanSara Feb 4, 2022
88021c9
Set an explicit requirement that was not properly enforced between ty…
ZanSara Feb 4, 2022
5d65f06
Add comment to setup.cfg
ZanSara Feb 4, 2022
47b282a
remove forced upgrades on pip install
ZanSara Feb 4, 2022
8961873
Remove constraint on PyYAML, probably unnecessary
ZanSara Feb 4, 2022
c4ccf7d
Re-enable persist credentials
ZanSara Feb 4, 2022
f2dc50c
Merge branch 'master' into upgrade-pydoc-markdown
ZanSara Feb 4, 2022
122bb6b
Update Documentation & Code Style
github-actions[bot] Feb 4, 2022
a279fff
Last test
ZanSara Feb 4, 2022
9adc149
Last test
ZanSara Feb 4, 2022
7fc7914
Test when bot should not trigger
ZanSara Feb 4, 2022
0010dd0
Update Documentation & Code Style
github-actions[bot] Feb 4, 2022
aba8eb5
Remove comment
ZanSara Feb 4, 2022
f6ea921
Merge branch 'upgrade-pydoc-markdown' of github.com:deepset-ai/haysta…
ZanSara Feb 4, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/update_docsstrings_tutorials.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pydoc-markdown==3.11.0
pip install pydoc-markdown
ZanSara marked this conversation as resolved.
Show resolved Hide resolved
pip install mkdocs
pip install jupytercontrib
pip install watchdog==1.0.2
Expand Down
112 changes: 29 additions & 83 deletions docs/_src/api/api/generator.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<a name="base"></a>
<a id="base"></a>

# Module base

<a name="base.BaseGenerator"></a>
<a id="base.BaseGenerator"></a>

## BaseGenerator

```python
Expand All @@ -10,30 +12,28 @@ class BaseGenerator(BaseComponent)

Abstract class for Generators

<a name="base.BaseGenerator.predict"></a>
<a id="base.BaseGenerator.predict"></a>

#### predict

```python
| @abstractmethod
| predict(query: str, documents: List[Document], top_k: Optional[int]) -> Dict
@abstractmethod
def predict(query: str, documents: List[Document], top_k: Optional[int]) -> Dict
```

Abstract method to generate answers.

**Arguments**:

- `query`: Query
- `documents`: Related documents (e.g. coming from a retriever) that the answer shall be conditioned on.
- `top_k`: Number of returned answers

**Returns**:
:param query: Query
:param documents: Related documents (e.g. coming from a retriever) that the answer shall be conditioned on.
:param top_k: Number of returned answers
:return: Generated answers plus additional infos in a dict

Generated answers plus additional infos in a dict
<a id="transformers"></a>

<a name="transformers"></a>
# Module transformers

<a name="transformers.RAGenerator"></a>
<a id="transformers.RAGenerator"></a>

## RAGenerator

```python
Expand Down Expand Up @@ -80,51 +80,21 @@ i.e. the model can easily adjust to domain documents even after training has fin
| }}]}
```

<a name="transformers.RAGenerator.__init__"></a>
#### \_\_init\_\_
<a id="transformers.RAGenerator.predict"></a>

```python
| __init__(model_name_or_path: str = "facebook/rag-token-nq", model_version: Optional[str] = None, retriever: Optional[DensePassageRetriever] = None, generator_type: RAGeneratorType = RAGeneratorType.TOKEN, top_k: int = 2, max_length: int = 200, min_length: int = 2, num_beams: int = 2, embed_title: bool = True, prefix: Optional[str] = None, use_gpu: bool = True)
```

Load a RAG model from Transformers along with passage_embedding_model.
See https://huggingface.co/transformers/model_doc/rag.html for more details

**Arguments**:

- `model_name_or_path`: Directory of a saved model or the name of a public model e.g.
'facebook/rag-token-nq', 'facebook/rag-sequence-nq'.
See https://huggingface.co/models for full list of available models.
- `model_version`: The version of model to use from the HuggingFace model hub. Can be tag name, branch name, or commit hash.
- `retriever`: `DensePassageRetriever` used to embedded passages for the docs passed to `predict()`. This is optional and is only needed if the docs you pass don't already contain embeddings in `Document.embedding`.
- `generator_type`: Which RAG generator implementation to use? RAG-TOKEN or RAG-SEQUENCE
- `top_k`: Number of independently generated text to return
- `max_length`: Maximum length of generated text
- `min_length`: Minimum length of generated text
- `num_beams`: Number of beams for beam search. 1 means no beam search.
- `embed_title`: Embedded the title of passage while generating embedding
- `prefix`: The prefix used by the generator's tokenizer.
- `use_gpu`: Whether to use GPU. Falls back on CPU if no GPU is available.

<a name="transformers.RAGenerator.predict"></a>
#### predict

```python
| predict(query: str, documents: List[Document], top_k: Optional[int] = None) -> Dict
def predict(query: str, documents: List[Document], top_k: Optional[int] = None) -> Dict
```

Generate the answer to the input query. The generation will be conditioned on the supplied documents.
These document can for example be retrieved via the Retriever.

**Arguments**:

- `query`: Query
- `documents`: Related documents (e.g. coming from a retriever) that the answer shall be conditioned on.
- `top_k`: Number of returned answers

**Returns**:

Generated answers plus additional infos in a dict like this:
:param query: Query
:param documents: Related documents (e.g. coming from a retriever) that the answer shall be conditioned on.
:param top_k: Number of returned answers
:return: Generated answers plus additional infos in a dict like this:

```python
| {'query': 'who got the first nobel prize in physics',
Expand All @@ -139,7 +109,8 @@ Generated answers plus additional infos in a dict like this:
| }}]}
```

<a name="transformers.Seq2SeqGenerator"></a>
<a id="transformers.Seq2SeqGenerator"></a>

## Seq2SeqGenerator

```python
Expand Down Expand Up @@ -189,44 +160,19 @@ For a list of all text-generation models see https://huggingface.co/models?pipel
|
```

<a name="transformers.Seq2SeqGenerator.__init__"></a>
#### \_\_init\_\_
<a id="transformers.Seq2SeqGenerator.predict"></a>

```python
| __init__(model_name_or_path: str, input_converter: Optional[Callable] = None, top_k: int = 1, max_length: int = 200, min_length: int = 2, num_beams: int = 8, use_gpu: bool = True)
```

**Arguments**:

- `model_name_or_path`: a HF model name for auto-regressive language model like GPT2, XLNet, XLM, Bart, T5 etc
- `input_converter`: an optional Callable to prepare model input for the underlying language model
specified in model_name_or_path parameter. The required __call__ method signature for
the Callable is:
__call__(tokenizer: PreTrainedTokenizer, query: str, documents: List[Document],
top_k: Optional[int] = None) -> BatchEncoding:
- `top_k`: Number of independently generated text to return
- `max_length`: Maximum length of generated text
- `min_length`: Minimum length of generated text
- `num_beams`: Number of beams for beam search. 1 means no beam search.
- `use_gpu`: Whether to use GPU or the CPU. Falls back on CPU if no GPU is available.

<a name="transformers.Seq2SeqGenerator.predict"></a>
#### predict

```python
| predict(query: str, documents: List[Document], top_k: Optional[int] = None) -> Dict
def predict(query: str, documents: List[Document], top_k: Optional[int] = None) -> Dict
```

Generate the answer to the input query. The generation will be conditioned on the supplied documents.
These document can be retrieved via the Retriever or supplied directly via predict method.

**Arguments**:

- `query`: Query
- `documents`: Related documents (e.g. coming from a retriever) that the answer shall be conditioned on.
- `top_k`: Number of returned answers

**Returns**:

Generated answers
:param query: Query
:param documents: Related documents (e.g. coming from a retriever) that the answer shall be conditioned on.
:param top_k: Number of returned answers
:return: Generated answers

8 changes: 4 additions & 4 deletions docs/_src/api/api/pydoc-markdown-answer-generator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ loaders:
search_path: [../../../../haystack/nodes/answer_generator]
modules: ['base', 'transformers']
ignore_when_discovered: ['__init__']
processor:
processors:
- type: filter
expression: not name.startswith('_') and default()
- documented_only: true
- do_not_filter_modules: false
- skip_empty_modules: true
documented_only: true
do_not_filter_modules: false
skip_empty_modules: true
renderer:
type: markdown
descriptive_class_title: false
Expand Down
8 changes: 4 additions & 4 deletions docs/_src/api/api/pydoc-markdown-crawler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ loaders:
search_path: [../../../../haystack/nodes/connector]
modules: ['crawler']
ignore_when_discovered: ['__init__']
processor:
processors:
- type: filter
expression: not name.startswith('_') and default()
- documented_only: true
- do_not_filter_modules: false
- skip_empty_modules: true
documented_only: true
do_not_filter_modules: false
skip_empty_modules: true
renderer:
type: markdown
descriptive_class_title: false
Expand Down
8 changes: 4 additions & 4 deletions docs/_src/api/api/pydoc-markdown-document-classifier.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ loaders:
search_path: [../../../../haystack/nodes/document_classifier]
modules: ['base', 'transformers']
ignore_when_discovered: ['__init__']
processor:
processors:
- type: filter
expression: not name.startswith('_') and default()
- documented_only: true
- do_not_filter_modules: false
- skip_empty_modules: true
documented_only: true
do_not_filter_modules: false
skip_empty_modules: true
renderer:
type: markdown
descriptive_class_title: false
Expand Down
8 changes: 4 additions & 4 deletions docs/_src/api/api/pydoc-markdown-document-store.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ loaders:
search_path: [../../../../haystack/document_stores]
modules: ['base', 'elasticsearch', 'memory', 'sql', 'faiss', 'milvus', 'weaviate', 'graphdb', 'deepsetcloud']
ignore_when_discovered: ['__init__']
processor:
processors:
- type: filter
expression: not name.startswith('_') and default()
- documented_only: true
- do_not_filter_modules: false
- skip_empty_modules: true
documented_only: true
do_not_filter_modules: false
skip_empty_modules: true
renderer:
type: markdown
descriptive_class_title: false
Expand Down
8 changes: 4 additions & 4 deletions docs/_src/api/api/pydoc-markdown-evaluation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ loaders:
search_path: [../../../../haystack/nodes/evaluator]
modules: ['evaluator']
ignore_when_discovered: ['__init__']
processor:
processors:
- type: filter
expression: not name.startswith('_') and default()
- documented_only: true
- do_not_filter_modules: false
- skip_empty_modules: true
documented_only: true
do_not_filter_modules: false
skip_empty_modules: true
renderer:
type: markdown
descriptive_class_title: false
Expand Down
8 changes: 4 additions & 4 deletions docs/_src/api/api/pydoc-markdown-extractor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ loaders:
search_path: [../../../../haystack/nodes/extractor]
modules: ['entity']
ignore_when_discovered: ['__init__']
processor:
processors:
- type: filter
expression: not name.startswith('_') and default()
- documented_only: true
- do_not_filter_modules: false
- skip_empty_modules: true
documented_only: true
do_not_filter_modules: false
skip_empty_modules: true
renderer:
type: markdown
descriptive_class_title: false
Expand Down
8 changes: 4 additions & 4 deletions docs/_src/api/api/pydoc-markdown-file-classifier.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ loaders:
search_path: [../../../../haystack/nodes/file_classifier]
modules: ['file_type']
ignore_when_discovered: ['__init__']
processor:
processors:
- type: filter
expression: not name.startswith('_') and default()
- documented_only: true
- do_not_filter_modules: false
- skip_empty_modules: true
documented_only: true
do_not_filter_modules: false
skip_empty_modules: true
renderer:
type: markdown
descriptive_class_title: false
Expand Down
8 changes: 4 additions & 4 deletions docs/_src/api/api/pydoc-markdown-file-converters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ loaders:
search_path: [../../../../haystack/nodes/file_converter]
modules: ['base', 'docx', 'image', 'markdown', 'pdf', 'tika', 'txt']
ignore_when_discovered: ['__init__']
processor:
processors:
- type: filter
expression: not name.startswith('_') and default()
- documented_only: true
- do_not_filter_modules: false
- skip_empty_modules: true
documented_only: true
do_not_filter_modules: false
skip_empty_modules: true
renderer:
type: markdown
descriptive_class_title: false
Expand Down
8 changes: 4 additions & 4 deletions docs/_src/api/api/pydoc-markdown-other.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ loaders:
search_path: [../../../../haystack/nodes/other]
modules: ['docs2answers', 'join_docs']
ignore_when_discovered: ['__init__']
processor:
processors:
- type: filter
expression: not name.startswith('_') and default()
- documented_only: true
- do_not_filter_modules: false
- skip_empty_modules: true
documented_only: true
do_not_filter_modules: false
skip_empty_modules: true
renderer:
type: markdown
descriptive_class_title: false
Expand Down
8 changes: 4 additions & 4 deletions docs/_src/api/api/pydoc-markdown-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ loaders:
search_path: [../../../../haystack/pipelines]
modules: ['base', 'standard_pipelines']
ignore_when_discovered: ['__init__']
processor:
processors:
- type: filter
expression: not name.startswith('_') and default()
- documented_only: true
- do_not_filter_modules: false
- skip_empty_modules: true
documented_only: true
do_not_filter_modules: false
skip_empty_modules: true
renderer:
type: markdown
descriptive_class_title: false
Expand Down
8 changes: 4 additions & 4 deletions docs/_src/api/api/pydoc-markdown-preprocessor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ loaders:
search_path: [../../../../haystack/nodes/preprocessor]
modules: ['base', 'preprocessor']
ignore_when_discovered: ['__init__']
processor:
processors:
- type: filter
expression: not name.startswith('_') and default()
- documented_only: true
- do_not_filter_modules: false
- skip_empty_modules: true
documented_only: true
do_not_filter_modules: false
skip_empty_modules: true
renderer:
type: markdown
descriptive_class_title: false
Expand Down
8 changes: 4 additions & 4 deletions docs/_src/api/api/pydoc-markdown-primitives.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ loaders:
search_path: [../../../../haystack/]
modules: ['schema']
ignore_when_discovered: ['__init__']
processor:
processors:
- type: filter
expression: not name.startswith('_') and default()
- documented_only: true
- do_not_filter_modules: false
- skip_empty_modules: true
documented_only: true
do_not_filter_modules: false
skip_empty_modules: true
renderer:
type: markdown
descriptive_class_title: false
Expand Down