Skip to content

Commit

Permalink
modify server configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
kurianbenoy committed May 19, 2024
1 parent 1d489c3 commit 5cfc8ea
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions api/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@

# Define the GPU type to be used for processing
# Refer - https://modal.com/docs/guide/gpu
GPU_TYPE = "T4"
GPU_TYPE = "H100"
SAMPLING_RATE = 16000
# Moved to large-v2 as felt large-v3 is hallucinating more
MODEL_SIZE = "large-v2"
THIRTY_MINS = 1800
SIXTY_MINS=3600


def download_models():
Expand Down Expand Up @@ -165,8 +166,7 @@ def process_audio(b64):
stub = Stub(name="seamless_m4t_speech", image=image)


# Timeout in 20 minutes
@stub.function(gpu=GPU_TYPE, timeout=THIRTY_MINS)
@stub.function(gpu=GPU_TYPE, timeout=SIXTY_MINS)
@web_endpoint(method="POST")
def generate_seamlessm4t_speech(item: Dict):
"""
Expand Down Expand Up @@ -285,7 +285,7 @@ def sliding_window_approch_timestamps(speech_timestamps_seconds):
return new_group_chunks # Return the list of new grouped chunks


@stub.function(gpu=GPU_TYPE, timeout=THIRTY_MINS)
@stub.function(gpu=GPU_TYPE, timeout=SIXTY_MINS)
@web_endpoint(method="POST")
def generate_faster_whisper_speech(item: Dict):
"""
Expand Down Expand Up @@ -388,7 +388,7 @@ def generate():
return {"message": "Internal server error", "code": 500}


@stub.function(gpu=GPU_TYPE, timeout=THIRTY_MINS)
@stub.function(gpu=GPU_TYPE, timeout=SIXTY_MINS)
@web_endpoint(method="POST")
def generate_vegam_faster_whisper(item: Dict):
import os
Expand Down Expand Up @@ -483,7 +483,7 @@ def generate():
return {"message": "Internal server error", "code": 500}


@stub.function(gpu=GPU_TYPE, timeout=THIRTY_MINS)
@stub.function(gpu=GPU_TYPE, timeout=SIXTY_MINS)
@web_endpoint(method="POST")
def generate_whisperx_speech(item: Dict):
"""
Expand Down Expand Up @@ -590,8 +590,7 @@ async def generate():
return {"message": "Internal server error", "code": 500}


# Timeout in 20 minutes
@stub.function(gpu=GPU_TYPE, timeout=THIRTY_MINS)
@stub.function(gpu=GPU_TYPE, timeout=SIXTY_MINS)
@web_endpoint(method="POST")
def youtube_generate_seamlessm4t_speech(item: Dict):
"""
Expand Down Expand Up @@ -725,8 +724,7 @@ def generate():
return {"message": "Internal server error", "code": 500}


# Timeout in 20 minutes
@stub.function(gpu=GPU_TYPE, timeout=THIRTY_MINS)
@stub.function(gpu=GPU_TYPE, timeout=SIXTY_MINS)
@web_endpoint(method="POST")
def youtube_generate_faster_whisper_speech(item: Dict):
"""
Expand Down Expand Up @@ -841,7 +839,7 @@ def generate():
return {"message": "Internal server error", "code": 500}


@stub.function(gpu=GPU_TYPE, timeout=THIRTY_MINS)
@stub.function(gpu=GPU_TYPE, timeout=SIXTY_MINS)
@web_endpoint(method="POST")
def youtube_generate_vegam_faster_whisper(item: Dict):
import os
Expand Down Expand Up @@ -948,7 +946,7 @@ def generate():
return {"message": "Internal server error", "code": 500}


@stub.function(gpu=GPU_TYPE, timeout=THIRTY_MINS)
@stub.function(gpu=GPU_TYPE, timeout=SIXTY_MINS)
@web_endpoint(method="POST")
def youtube_generate_whisperx_speech(item: Dict):
"""
Expand Down

0 comments on commit 5cfc8ea

Please sign in to comment.