Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/transformers/utils/doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,9 @@ def _prepare_output_docstrings(output_type, config_class, min_indent=None):

```python
>>> # target is "nice puppet"
>>> target_start_index, target_end_index = torch.tensor([14]), torch.tensor([15])
>>> target_start_index, target_end_index = torch.tensor([{qa_target_start_index}]), torch.tensor(
... [{qa_target_end_index}]
... )

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should be on two separate lines since there is formatting.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


>>> outputs = model(**inputs, start_positions=target_start_index, end_positions=target_end_index)
>>> loss = outputs.loss
Expand Down Expand Up @@ -1054,6 +1056,8 @@ def add_code_sample_docstrings(
output_type=None,
config_class=None,
mask="[MASK]",
qa_target_start_index=14,
qa_target_end_index=15,
model_cls=None,
modality=None,
expected_output="",
Expand All @@ -1078,6 +1082,8 @@ def docstring_decorator(fn):
processor_class=processor_class,
checkpoint=checkpoint,
mask=mask,
qa_target_start_index=qa_target_start_index,
qa_target_end_index=qa_target_end_index,
expected_output=expected_output,
expected_loss=expected_loss,
)
Expand Down