mirror of
https://github.com/wassname/ray.git
synced 2026-09-11 12:43:20 +08:00
[docker] Detect CPUs in container correctly (#10507)
Co-authored-by: simon-mo <simon.mo@hey.com> Co-authored-by: Richard Liaw <rliaw@berkeley.edu> Co-authored-by: Alex Wu <itswu.alex@gmail.com>
This commit is contained in:
co-authored by
simon-mo
Richard Liaw
Alex Wu
parent
660aee6311
commit
5bc2ba38fd
@@ -50,11 +50,13 @@ Serve a function by defining a function, an endpoint, and a backend (in this cas
|
||||
connecting the two by setting traffic from the endpoint to the backend.
|
||||
|
||||
.. literalinclude:: ../../../python/ray/serve/examples/doc/quickstart_function.py
|
||||
:lines: 2-4,6-7,9-
|
||||
|
||||
Serve a stateful class by defining a class (``Counter``), creating an endpoint and a backend, then connecting
|
||||
the two by setting traffic from the endpoint to the backend.
|
||||
|
||||
.. literalinclude:: ../../../python/ray/serve/examples/doc/quickstart_class.py
|
||||
:lines: 2-4,6-7,9-
|
||||
|
||||
See :doc:`key-concepts` for more exhaustive coverage about Ray Serve and its core concepts.
|
||||
|
||||
|
||||
@@ -97,6 +97,7 @@ import torch
|
||||
import torch.nn as nn
|
||||
import torch.nn.functional as F
|
||||
import torch.optim as optim
|
||||
import ray
|
||||
from ray import tune, serve
|
||||
from ray.serve.exceptions import RayServeException
|
||||
from ray.tune import CLIReporter
|
||||
@@ -613,6 +614,9 @@ if __name__ == "__main__":
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.smoke_test:
|
||||
ray.init(num_cpus=2)
|
||||
|
||||
model_dir = os.path.expanduser(args.model_dir)
|
||||
|
||||
if args.query >= 0:
|
||||
|
||||
Reference in New Issue
Block a user