Added timeouts to give Modal time
This commit is contained in:
@@ -7,11 +7,11 @@ app = modal.App("llama")
|
|||||||
image = Image.debian_slim().pip_install("torch", "transformers", "bitsandbytes", "accelerate")
|
image = Image.debian_slim().pip_install("torch", "transformers", "bitsandbytes", "accelerate")
|
||||||
secrets = [modal.Secret.from_name("hf-secret")]
|
secrets = [modal.Secret.from_name("hf-secret")]
|
||||||
GPU = "T4"
|
GPU = "T4"
|
||||||
MODEL_NAME = "meta-llama/Meta-Llama-3.1-8B"
|
MODEL_NAME = "meta-llama/Meta-Llama-3.1-8B" # "google/gemma-2-2b"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@app.function(image=image, secrets=secrets, gpu=GPU)
|
@app.function(image=image, secrets=secrets, gpu=GPU, timeout=1800)
|
||||||
def generate(prompt: str) -> str:
|
def generate(prompt: str) -> str:
|
||||||
import os
|
import os
|
||||||
import torch
|
import torch
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ REVISION = "e8d637df551603dc86cd7a1598a8f44af4d7ae36"
|
|||||||
FINETUNED_MODEL = f"{HF_USER}/{PROJECT_RUN_NAME}"
|
FINETUNED_MODEL = f"{HF_USER}/{PROJECT_RUN_NAME}"
|
||||||
|
|
||||||
|
|
||||||
@app.function(image=image, secrets=secrets, gpu=GPU)
|
@app.function(image=image, secrets=secrets, gpu=GPU, timeout=1800)
|
||||||
def price(description: str) -> float:
|
def price(description: str) -> float:
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ REVISION = "e8d637df551603dc86cd7a1598a8f44af4d7ae36"
|
|||||||
FINETUNED_MODEL = f"{HF_USER}/{PROJECT_RUN_NAME}"
|
FINETUNED_MODEL = f"{HF_USER}/{PROJECT_RUN_NAME}"
|
||||||
|
|
||||||
|
|
||||||
@app.function(image=image, secrets=secrets, gpu=GPU)
|
@app.function(image=image, secrets=secrets, gpu=GPU, timeout=1800)
|
||||||
def price(description: str) -> float:
|
def price(description: str) -> float:
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ QUESTION = "How much does this cost to the nearest dollar?"
|
|||||||
PREFIX = "Price is $"
|
PREFIX = "Price is $"
|
||||||
|
|
||||||
|
|
||||||
@app.cls(image=image, secrets=secrets, gpu=GPU)
|
@app.cls(image=image, secrets=secrets, gpu=GPU, timeout=1800)
|
||||||
class Pricer:
|
class Pricer:
|
||||||
@modal.build()
|
@modal.build()
|
||||||
def download_model_to_folder(self):
|
def download_model_to_folder(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user