-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Summary
Hello, I'm trying to use uv in conjuction with Ray locally. When starting a ray serve application I'm unable to stop the program with Ctrl-c as I normally would.
Simple example
# /// script
# dependencies = [
# "transformers",
# "torch",
# "ray[serve]",
# "starlette",
# ]
# ///
import ray
from ray import serve
from starlette.requests import Request
from transformers import pipeline
@serve.deployment(num_replicas=4)
class Translator:
def __init__(self):
# Load model
self.model = pipeline("translation_en_to_fr", model="t5-small")
def translate(self, text: str) -> str:
# Run inference
model_output = self.model(text)
# Post-process output to return only the translation text
translation = model_output[0]["translation_text"]
return translation
async def __call__(self, http_request: Request) -> str:
english_text: str = await http_request.json()
return self.translate(english_text)
translator_app = Translator.bind()uv run -- serve run ray_serve:translator_app
Doing ctrl c here does nothing
serve run ray_serve:translator_app
This will shut down the server like normal.
Ray version: 2.41.0
Platform
macOS Darwin 23.5.0 arm64
Version
0.5.24
Python version
Python 3.12.7
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working