Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
vllm_cscc
Commits
65097ca0
Unverified
Commit
65097ca0
authored
Jan 09, 2025
by
Cyrus Leung
Committed by
GitHub
Jan 09, 2025
Browse files
[Doc] Add model development API Reference (#11884)
Signed-off-by:
DarkLight1337
<
tlleungac@connect.ust.hk
>
parent
1d967acb
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
54 additions
and
9 deletions
+54
-9
.buildkite/test-pipeline.yaml
.buildkite/test-pipeline.yaml
+1
-1
docs/source/api/inference_params.md
docs/source/api/inference_params.md
+2
-3
docs/source/api/model/adapters.md
docs/source/api/model/adapters.md
+9
-0
docs/source/api/model/index.md
docs/source/api/model/index.md
+12
-0
docs/source/api/model/interfaces.md
docs/source/api/model/interfaces.md
+9
-0
docs/source/api/model/interfaces_base.md
docs/source/api/model/interfaces_base.md
+9
-0
docs/source/index.md
docs/source/index.md
+2
-1
vllm/model_executor/models/interfaces.py
vllm/model_executor/models/interfaces.py
+7
-4
vllm/model_executor/models/interfaces_base.py
vllm/model_executor/models/interfaces_base.py
+3
-0
No files found.
.buildkite/test-pipeline.yaml
View file @
65097ca0
...
@@ -38,7 +38,7 @@ steps:
...
@@ -38,7 +38,7 @@ steps:
-
pip install -r requirements-docs.txt
-
pip install -r requirements-docs.txt
-
SPHINXOPTS=\"-W\" make html
-
SPHINXOPTS=\"-W\" make html
# Check API reference (if it fails, you may have missing mock imports)
# Check API reference (if it fails, you may have missing mock imports)
-
grep \"sig sig-object py\" build/html/api/params.html
-
grep \"sig sig-object py\" build/html/api/
inference_
params.html
-
label
:
Async Engine, Inputs, Utils, Worker Test
# 24min
-
label
:
Async Engine, Inputs, Utils, Worker Test
# 24min
fast_check
:
true
fast_check
:
true
...
...
docs/source/api/params.md
→
docs/source/api/
inference_
params.md
View file @
65097ca0
#
Optional
Parameters
#
Inference
Parameters
Optional
parameters for vLLM APIs.
Inference
parameters for vLLM APIs.
(sampling-params)=
(sampling-params)=
...
@@ -19,4 +19,3 @@ Optional parameters for vLLM APIs.
...
@@ -19,4 +19,3 @@ Optional parameters for vLLM APIs.
.. autoclass:: vllm.PoolingParams
.. autoclass:: vllm.PoolingParams
:members:
:members:
```
```
docs/source/api/model/adapters.md
0 → 100644
View file @
65097ca0
# Model Adapters
## Module Contents
```
{eval-rst}
.. automodule:: vllm.model_executor.models.adapters
:members:
:member-order: bysource
```
docs/source/api/model/index.md
0 → 100644
View file @
65097ca0
# Model Development
## Submodules
```
{toctree}
:maxdepth: 1
interfaces_base
interfaces
adapters
```
docs/source/api/model/interfaces.md
0 → 100644
View file @
65097ca0
# Optional Interfaces
## Module Contents
```
{eval-rst}
.. automodule:: vllm.model_executor.models.interfaces
:members:
:member-order: bysource
```
docs/source/api/model/interfaces_base.md
0 → 100644
View file @
65097ca0
# Base Model Interfaces
## Module Contents
```
{eval-rst}
.. automodule:: vllm.model_executor.models.interfaces_base
:members:
:member-order: bysource
```
docs/source/index.md
View file @
65097ca0
...
@@ -139,8 +139,9 @@ community/sponsors
...
@@ -139,8 +139,9 @@ community/sponsors
api/offline_inference/index
api/offline_inference/index
api/engine/index
api/engine/index
api/inference_params
api/multimodal/index
api/multimodal/index
api/
params
api/
model/index
```
```
% Design Documents: Details about vLLM internals
% Design Documents: Details about vLLM internals
...
...
vllm/model_executor/models/interfaces.py
View file @
65097ca0
...
@@ -38,11 +38,13 @@ class SupportsMultiModal(Protocol):
...
@@ -38,11 +38,13 @@ class SupportsMultiModal(Protocol):
to be merged with text embeddings.
to be merged with text embeddings.
The output embeddings must be one of the following formats:
The output embeddings must be one of the following formats:
- A list or tuple of 2D tensors, where each tensor corresponds to
- A list or tuple of 2D tensors, where each tensor corresponds to
each input multimodal data item (e.g, image).
each input multimodal data item (e.g, image).
- A single 3D tensor, with the batch dimension grouping the 2D tensors.
- A single 3D tensor, with the batch dimension grouping the 2D tensors.
NOTE: The returned multimodal embeddings must be in the same order as
Note:
The returned multimodal embeddings must be in the same order as
the appearances of their corresponding multimodal data item in the
the appearances of their corresponding multimodal data item in the
input prompt.
input prompt.
"""
"""
...
@@ -59,6 +61,7 @@ class SupportsMultiModal(Protocol):
...
@@ -59,6 +61,7 @@ class SupportsMultiModal(Protocol):
)
->
torch
.
Tensor
:
)
->
torch
.
Tensor
:
...
...
@
overload
def
get_input_embeddings
(
def
get_input_embeddings
(
self
,
self
,
input_ids
:
torch
.
Tensor
,
input_ids
:
torch
.
Tensor
,
...
...
vllm/model_executor/models/interfaces_base.py
View file @
65097ca0
...
@@ -35,6 +35,7 @@ T_co = TypeVar("T_co", default=torch.Tensor, covariant=True)
...
@@ -35,6 +35,7 @@ T_co = TypeVar("T_co", default=torch.Tensor, covariant=True)
@
runtime_checkable
@
runtime_checkable
class
VllmModel
(
Protocol
[
C_co
,
T_co
]):
class
VllmModel
(
Protocol
[
C_co
,
T_co
]):
"""The interface required for all models in vLLM."""
def
__init__
(
def
__init__
(
self
,
self
,
...
@@ -97,6 +98,7 @@ def is_vllm_model(
...
@@ -97,6 +98,7 @@ def is_vllm_model(
@
runtime_checkable
@
runtime_checkable
class
VllmModelForTextGeneration
(
VllmModel
[
C_co
,
T
],
Protocol
[
C_co
,
T
]):
class
VllmModelForTextGeneration
(
VllmModel
[
C_co
,
T
],
Protocol
[
C_co
,
T
]):
"""The interface required for all generative models in vLLM."""
def
compute_logits
(
def
compute_logits
(
self
,
self
,
...
@@ -142,6 +144,7 @@ def is_text_generation_model(
...
@@ -142,6 +144,7 @@ def is_text_generation_model(
@
runtime_checkable
@
runtime_checkable
class
VllmModelForPooling
(
VllmModel
[
C_co
,
T
],
Protocol
[
C_co
,
T
]):
class
VllmModelForPooling
(
VllmModel
[
C_co
,
T
],
Protocol
[
C_co
,
T
]):
"""The interface required for all pooling models in vLLM."""
def
pooler
(
def
pooler
(
self
,
self
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment