Skip to content

Commit 306dc6e

Browse files
Update README.md (huggingface#5267)
Co-authored-by: YiYi Xu <[email protected]>
1 parent dd25ef5 commit 306dc6e

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

docs/README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ When adding a new pipeline:
128128
- Possible an end-to-end example of how to use it
129129
- Add all the pipeline classes that should be linked in the diffusion model. These classes should be added using our Markdown syntax. By default as follows:
130130

131-
```
131+
```py
132132
## XXXPipeline
133133

134134
[[autodoc]] XXXPipeline
@@ -138,7 +138,7 @@ When adding a new pipeline:
138138

139139
This will include every public method of the pipeline that is documented, as well as the `__call__` method that is not documented by default. If you just want to add additional methods that are not documented, you can put the list of all methods to add in a list that contains `all`.
140140

141-
```
141+
```py
142142
[[autodoc]] XXXPipeline
143143
- all
144144
- __call__
@@ -172,7 +172,7 @@ Arguments should be defined with the `Args:` (or `Arguments:` or `Parameters:`)
172172
an indentation. The argument should be followed by its type, with its shape if it is a tensor, a colon, and its
173173
description:
174174

175-
```
175+
```py
176176
Args:
177177
n_layers (`int`): The number of layers of the model.
178178
```
@@ -182,7 +182,7 @@ after the argument.
182182

183183
Here's an example showcasing everything so far:
184184

185-
```
185+
```py
186186
Args:
187187
input_ids (`torch.LongTensor` of shape `(batch_size, sequence_length)`):
188188
Indices of input sequence tokens in the vocabulary.
@@ -196,13 +196,13 @@ Here's an example showcasing everything so far:
196196
For optional arguments or arguments with defaults we follow the following syntax: imagine we have a function with the
197197
following signature:
198198

199-
```
199+
```py
200200
def my_function(x: str = None, a: float = 1):
201201
```
202202

203203
then its documentation should look like this:
204204

205-
```
205+
```py
206206
Args:
207207
x (`str`, *optional*):
208208
This argument controls ...
@@ -235,14 +235,14 @@ building the return.
235235

236236
Here's an example of a single value return:
237237

238-
```
238+
```py
239239
Returns:
240240
`List[int]`: A list of integers in the range [0, 1] --- 1 for a special token, 0 for a sequence token.
241241
```
242242

243243
Here's an example of a tuple return, comprising several objects:
244244

245-
```
245+
```py
246246
Returns:
247247
`tuple(torch.FloatTensor)` comprising various elements depending on the configuration ([`BertConfig`]) and inputs:
248248
- ** loss** (*optional*, returned when `masked_lm_labels` is provided) `torch.FloatTensor` of shape `(1,)` --

0 commit comments

Comments
 (0)