Upload ms-swift/docs/README.md with huggingface_hub
Browse files- ms-swift/docs/README.md +37 -0
ms-swift/docs/README.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
## maintain docs
|
| 2 |
+
1. build docs
|
| 3 |
+
```shell
|
| 4 |
+
# in root directory:
|
| 5 |
+
make docs
|
| 6 |
+
```
|
| 7 |
+
|
| 8 |
+
2. doc string format
|
| 9 |
+
|
| 10 |
+
We adopt the google style docstring format as the standard, please refer to the following documents.
|
| 11 |
+
1. Google Python style guide docstring [link](http://google.github.io/styleguide/pyguide.html#381-docstrings)
|
| 12 |
+
2. Google docstring example [link](https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html)
|
| 13 |
+
3. sample:torch.nn.modules.conv [link](https://pytorch.org/docs/stable/_modules/torch/nn/modules/conv.html#Conv1d)
|
| 14 |
+
4. load function as an example:
|
| 15 |
+
|
| 16 |
+
```python
|
| 17 |
+
def load(file, file_format=None, **kwargs):
|
| 18 |
+
"""Load data from json/yaml/pickle files.
|
| 19 |
+
|
| 20 |
+
This method provides a unified api for loading data from serialized files.
|
| 21 |
+
|
| 22 |
+
Args:
|
| 23 |
+
file (str or :obj:`Path` or file-like object): Filename or a file-like
|
| 24 |
+
object.
|
| 25 |
+
file_format (str, optional): If not specified, the file format will be
|
| 26 |
+
inferred from the file extension, otherwise use the specified one.
|
| 27 |
+
Currently supported formats include "json", "yaml/yml".
|
| 28 |
+
|
| 29 |
+
Examples:
|
| 30 |
+
>>> load('/path/of/your/file') # file is stored in disk
|
| 31 |
+
>>> load('https://path/of/your/file') # file is stored on internet
|
| 32 |
+
>>> load('oss://path/of/your/file') # file is stored in petrel
|
| 33 |
+
|
| 34 |
+
Returns:
|
| 35 |
+
The content from the file.
|
| 36 |
+
"""
|
| 37 |
+
```
|