Spaces:
Runtime error
Runtime error
BjarneBepaData
commited on
Commit
•
c971876
1
Parent(s):
4f17583
Download the models in the build phase
Browse files- Dockerfile +4 -0
- app/main.py +2 -3
Dockerfile
CHANGED
@@ -19,6 +19,10 @@ WORKDIR /code
|
|
19 |
#
|
20 |
COPY ./requirements.txt /code/requirements.txt
|
21 |
|
|
|
|
|
|
|
|
|
22 |
#
|
23 |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
24 |
|
|
|
19 |
#
|
20 |
COPY ./requirements.txt /code/requirements.txt
|
21 |
|
22 |
+
# Download the models
|
23 |
+
RUN python -c 'from transformers import AutoModelForSpeechSeq2Seq; AutoModelForSpeechSeq2Seq.from_pretrained("openai/whisper-large-v3");'
|
24 |
+
RUN python -c 'from transformers import AutoProcessor; AutoProcessor.from_pretrained("openai/whisper-large-v3");'
|
25 |
+
|
26 |
#
|
27 |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
28 |
|
app/main.py
CHANGED
@@ -10,12 +10,11 @@ torch_dtype = torch.float16 if torch.cuda.is_available() else torch.float32
|
|
10 |
model_id = "openai/whisper-large-v3"
|
11 |
|
12 |
model = AutoModelForSpeechSeq2Seq.from_pretrained(
|
13 |
-
model_id, torch_dtype=torch_dtype, low_cpu_mem_usage=True, use_safetensors=True
|
14 |
-
cache_dir="./"
|
15 |
)
|
16 |
model.to(device)
|
17 |
|
18 |
-
processor = AutoProcessor.from_pretrained(model_id
|
19 |
|
20 |
pipe = pipeline(
|
21 |
"automatic-speech-recognition",
|
|
|
10 |
model_id = "openai/whisper-large-v3"
|
11 |
|
12 |
model = AutoModelForSpeechSeq2Seq.from_pretrained(
|
13 |
+
model_id, torch_dtype=torch_dtype, low_cpu_mem_usage=True, use_safetensors=True
|
|
|
14 |
)
|
15 |
model.to(device)
|
16 |
|
17 |
+
processor = AutoProcessor.from_pretrained(model_id)
|
18 |
|
19 |
pipe = pipeline(
|
20 |
"automatic-speech-recognition",
|