jhansss commited on
Commit
6983b01
·
1 Parent(s): 602262e

Add HF_TOKEN environment variable

Browse files
Files changed (2) hide show
  1. modules/asr.py +3 -2
  2. modules/llm.py +3 -0
modules/asr.py CHANGED
@@ -1,5 +1,4 @@
1
- from __future__ import annotations
2
-
3
  from abc import ABC, abstractmethod
4
 
5
  import librosa
@@ -7,6 +6,7 @@ import numpy as np
7
  from transformers import pipeline
8
 
9
  ASR_MODEL_REGISTRY = {}
 
10
 
11
 
12
  class AbstractASRModel(ABC):
@@ -52,6 +52,7 @@ class WhisperASR(AbstractASRModel):
52
  "automatic-speech-recognition",
53
  model=model_id,
54
  device=0 if device == "cuda" else -1,
 
55
  **kwargs,
56
  )
57
 
 
1
+ import os
 
2
  from abc import ABC, abstractmethod
3
 
4
  import librosa
 
6
  from transformers import pipeline
7
 
8
  ASR_MODEL_REGISTRY = {}
9
+ hf_token = os.getenv("HF_TOKEN")
10
 
11
 
12
  class AbstractASRModel(ABC):
 
52
  "automatic-speech-recognition",
53
  model=model_id,
54
  device=0 if device == "cuda" else -1,
55
+ token=hf_token,
56
  **kwargs,
57
  )
58
 
modules/llm.py CHANGED
@@ -1,8 +1,10 @@
 
1
  from abc import ABC, abstractmethod
2
 
3
  from transformers import pipeline
4
 
5
  LLM_MODEL_REGISTRY = {}
 
6
 
7
 
8
  class AbstractLLMModel(ABC):
@@ -46,6 +48,7 @@ class HFTextGenerationLLM(AbstractLLMModel):
46
  model=model_id,
47
  device=0 if device == "cuda" else -1,
48
  return_full_text=False,
 
49
  **kwargs,
50
  )
51
 
 
1
+ import os
2
  from abc import ABC, abstractmethod
3
 
4
  from transformers import pipeline
5
 
6
  LLM_MODEL_REGISTRY = {}
7
+ hf_token = os.getenv("HF_TOKEN")
8
 
9
 
10
  class AbstractLLMModel(ABC):
 
48
  model=model_id,
49
  device=0 if device == "cuda" else -1,
50
  return_full_text=False,
51
+ token=hf_token,
52
  **kwargs,
53
  )
54