A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 17, 09:15 UTC
Add initial sphinx docs (#120)
Woosuk Kwon committed
May 22, 2023 at 17:02 UTC
19d289943978d72fa6b96eeaae154a418e82097c
9 files changed
+200
.gitignore
+1
@@ -6,6 +6,7 @@
6
*.log
7
*.csv
8
build/
9
+docs/build/
10
11
*.pkl
12
*.png
docs/Makefile
new
+20
@@ -0,0 +1,20 @@
1
+# Minimal makefile for Sphinx documentation
2
+#
3
+
4
+# You can set these variables from the command line, and also
5
+# from the environment for the first two.
6
+SPHINXOPTS ?=
7
+SPHINXBUILD ?= sphinx-build
8
+SOURCEDIR = source
9
+BUILDDIR = build
10
+
11
+# Put it first so that "make" without argument is like "make help".
12
+help:
13
+ @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14
+
15
+.PHONY: help Makefile
16
+
17
+# Catch-all target: route all unknown targets to Sphinx using the new
18
+# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19
+%: Makefile
20
+ @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
docs/README.md
new
+20
@@ -0,0 +1,20 @@
1
+# CacheFlow documents
2
+
3
+## Build the docs
4
+
5
+```bash
6
+# Install dependencies.
7
+pip -r requirements-docs.txt
8
+
9
+# Build the docs.
10
+make clean
11
+make html
12
+```
13
+
14
+## Open the docs with your brower
15
+
16
+```bash
17
+cd build/html
18
+python -m http.server
19
+```
20
+Launch your browser and open localhost:8000.
docs/make.bat
new
+35
@@ -0,0 +1,35 @@
1
+@ECHO OFF
2
+
3
+pushd %~dp0
4
+
5
+REM Command file for Sphinx documentation
6
+
7
+if "%SPHINXBUILD%" == "" (
8
+ set SPHINXBUILD=sphinx-build
9
+)
10
+set SOURCEDIR=source
11
+set BUILDDIR=build
12
+
13
+%SPHINXBUILD% >NUL 2>NUL
14
+if errorlevel 9009 (
15
+ echo.
16
+ echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
17
+ echo.installed, then set the SPHINXBUILD environment variable to point
18
+ echo.to the full path of the 'sphinx-build' executable. Alternatively you
19
+ echo.may add the Sphinx directory to PATH.
20
+ echo.
21
+ echo.If you don't have Sphinx installed, grab it from
22
+ echo.https://www.sphinx-doc.org/
23
+ exit /b 1
24
+)
25
+
26
+if "%1" == "" goto help
27
+
28
+%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
29
+goto end
30
+
31
+:help
32
+%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
33
+
34
+:end
35
+popd
docs/requirements-docs.txt
new
+3
@@ -0,0 +1,3 @@
1
+sphinx
2
+sphinx-click
3
+sphinx-copybutton
docs/source/conf.py
new
+65
@@ -0,0 +1,65 @@
1
+# Configuration file for the Sphinx documentation builder.
2
+#
3
+# This file only contains a selection of the most common options. For a full
4
+# list see the documentation:
5
+# https://www.sphinx-doc.org/en/master/usage/configuration.html
6
+
7
+# -- Path setup --------------------------------------------------------------
8
+
9
+# If extensions (or modules to document with autodoc) are in another directory,
10
+# add these directories to sys.path here. If the directory is relative to the
11
+# documentation root, use os.path.abspath to make it absolute, like shown here.
12
+#
13
+# import os
14
+# import sys
15
+# sys.path.insert(0, os.path.abspath('.'))
16
+
17
+
18
+# -- Project information -----------------------------------------------------
19
+
20
+project = 'CacheFlow'
21
+copyright = '2023, CacheFlow Team'
22
+author = 'the CacheFlow Team'
23
+
24
+
25
+# -- General configuration ---------------------------------------------------
26
+
27
+# Add any Sphinx extension module names here, as strings. They can be
28
+# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
29
+# ones.
30
+extensions = [
31
+ "sphinx.ext.napoleon",
32
+ "sphinx.ext.viewcode",
33
+ "sphinx.ext.intersphinx",
34
+ "sphinx_copybutton",
35
+]
36
+
37
+# Add any paths that contain templates here, relative to this directory.
38
+templates_path = ['_templates']
39
+
40
+# List of patterns, relative to source directory, that match files and
41
+# directories to ignore when looking for source files.
42
+# This pattern also affects html_static_path and html_extra_path.
43
+exclude_patterns = []
44
+
45
+# Exclude the prompt "$" when copying code
46
+copybutton_prompt_text = r"\$ "
47
+copybutton_prompt_is_regexp = True
48
+
49
+# -- Options for HTML output -------------------------------------------------
50
+
51
+# The theme to use for HTML and HTML Help pages. See the documentation for
52
+# a list of builtin themes.
53
+#
54
+html_title = project
55
+html_theme = 'sphinx_book_theme'
56
+html_theme_options = {
57
+ 'path_to_docs': 'docs/source',
58
+ 'repository_url': 'https://github.com/WoosukKwon/cacheflow',
59
+ 'use_repository_button': True,
60
+}
61
+
62
+# Add any paths that contain custom static files (such as style sheets) here,
63
+# relative to this directory. They are copied after the builtin static files,
64
+# so a file named "default.css" will overwrite the builtin "default.css".
65
+html_static_path = ['_static']
docs/source/getting_started/installation.rst
new
+10
@@ -0,0 +1,10 @@
1
+Installation
2
+============
3
+
4
+Build from source
5
+-----------------
6
+
7
+.. code-block:: console
8
+
9
+ $ pip install -r requirements.txt
10
+ $ pip install -e . # This may take several minutes.
docs/source/getting_started/quickstart.rst
new
+34
@@ -0,0 +1,34 @@
1
+Quickstart
2
+==========
3
+
4
+LLM
5
+---
6
+
7
+Placeholder.
8
+
9
+.. code-block:: python
10
+
11
+ from cacheflow import LLM, SamplingParams
12
+
13
+ # Sample prompts.
14
+ prompts = [
15
+ "Hello, my name is",
16
+ "The president of the United States is",
17
+ "The capital of France is",
18
+ "The future of AI is",
19
+ ]
20
+ # Create a sampling params object.
21
+ sampling_params = SamplingParams(temperature=0.8, top_p=0.95)
22
+
23
+ # Create an LLM.
24
+ llm = LLM(model="facebook/opt-125m")
25
+
26
+ # Generate texts from the prompts. The output is a list of RequestOutput objects
27
+ # that contain the prompt, generated text, and other information.
28
+ outputs = llm.generate(prompts, sampling_params)
29
+
30
+ # Print the outputs.
31
+ for output in outputs:
32
+ prompt = output.prompt
33
+ generated_text = output.outputs[0].text
34
+ print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")
docs/source/index.rst
new
+12
@@ -0,0 +1,12 @@
1
+Welcome to CacheFlow!
2
+=====================
3
+
4
+Documentation
5
+-------------
6
+
7
+.. toctree::
8
+ :maxdepth: 1
9
+ :caption: Getting Started
10
+
11
+ getting_started/installation
12
+ getting_started/quickstart