BjarneBepaData commited on
Commit
97c3bac
1 Parent(s): 8c95ac1

Change the cache_dir

Browse files
Files changed (1) hide show
  1. app/main.py +4 -3
app/main.py CHANGED
@@ -4,17 +4,18 @@ from transformers import AutoModelForSpeechSeq2Seq, AutoProcessor, pipeline
4
 
5
  app = FastAPI()
6
 
7
- device = "cuda:0" if torch.cuda.is_available() else "cpu"
8
  torch_dtype = torch.float16 if torch.cuda.is_available() else torch.float32
9
 
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",
 
4
 
5
  app = FastAPI()
6
 
7
+ device = "cuda" if torch.cuda.is_available() else "cpu"
8
  torch_dtype = torch.float16 if torch.cuda.is_available() else torch.float32
9
 
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, cache_dir="./")
19
 
20
  pipe = pipeline(
21
  "automatic-speech-recognition",