Spaces:
Runtime error
Runtime error
StevenChen16
commited on
Commit
β’
88962a5
1
Parent(s):
52c56bf
4th commit - change position of spaces.GPU
Browse files
app.py
CHANGED
@@ -172,7 +172,6 @@ def query_vector_store(vector_store: FAISS, query, k=4, relevance_threshold=0.8)
|
|
172 |
context = [doc.page_content for doc in similar_docs]
|
173 |
return context
|
174 |
|
175 |
-
@spaces.GPU
|
176 |
class ModelWorker:
|
177 |
def __init__(self, model_path, device='cuda'):
|
178 |
self.device = device
|
@@ -212,6 +211,7 @@ class ModelWorker:
|
|
212 |
for token_id in streamer:
|
213 |
yield token_id
|
214 |
|
|
|
215 |
def generate_stream_gate(self, params):
|
216 |
try:
|
217 |
for x in self.generate_stream(params):
|
@@ -263,7 +263,7 @@ if __name__ == "__main__":
|
|
263 |
parser.add_argument("--flow-path", type=str, default="THUDM/glm-4-voice-decoder")
|
264 |
parser.add_argument("--model-path", type=str, default="THUDM/glm-4-voice-9b")
|
265 |
parser.add_argument("--tokenizer-path", type=str, default="THUDM/glm-4-voice-tokenizer")
|
266 |
-
parser.add_argument("--whisper_model", type=str, default="base")
|
267 |
parser.add_argument("--share", action='store_true')
|
268 |
args = parser.parse_args()
|
269 |
|
@@ -285,9 +285,9 @@ if __name__ == "__main__":
|
|
285 |
model_worker = None
|
286 |
|
287 |
# RAG configuration
|
288 |
-
Embedding_Model = '/
|
289 |
-
file_paths = [
|
290 |
-
store_path = '
|
291 |
|
292 |
def initialize_fn():
|
293 |
global audio_decoder, feature_extractor, whisper_model, glm_model, glm_tokenizer
|
@@ -312,7 +312,7 @@ if __name__ == "__main__":
|
|
312 |
embedding_model = create_embedding_model(Embedding_Model)
|
313 |
vector_store = load_or_create_store(store_path, file_paths, embedding_model)
|
314 |
|
315 |
-
whisper_transcribe_model = whisper.load_model("
|
316 |
|
317 |
def clear_fn():
|
318 |
return [], [], '', '', '', None, None
|
|
|
172 |
context = [doc.page_content for doc in similar_docs]
|
173 |
return context
|
174 |
|
|
|
175 |
class ModelWorker:
|
176 |
def __init__(self, model_path, device='cuda'):
|
177 |
self.device = device
|
|
|
211 |
for token_id in streamer:
|
212 |
yield token_id
|
213 |
|
214 |
+
@spaces.GPU
|
215 |
def generate_stream_gate(self, params):
|
216 |
try:
|
217 |
for x in self.generate_stream(params):
|
|
|
263 |
parser.add_argument("--flow-path", type=str, default="THUDM/glm-4-voice-decoder")
|
264 |
parser.add_argument("--model-path", type=str, default="THUDM/glm-4-voice-9b")
|
265 |
parser.add_argument("--tokenizer-path", type=str, default="THUDM/glm-4-voice-tokenizer")
|
266 |
+
# parser.add_argument("--whisper_model", type=str, default="base")
|
267 |
parser.add_argument("--share", action='store_true')
|
268 |
args = parser.parse_args()
|
269 |
|
|
|
285 |
model_worker = None
|
286 |
|
287 |
# RAG configuration
|
288 |
+
Embedding_Model = 'intfloat/multilingual-e5-large-instruct'
|
289 |
+
file_paths = []
|
290 |
+
store_path = './data.faiss'
|
291 |
|
292 |
def initialize_fn():
|
293 |
global audio_decoder, feature_extractor, whisper_model, glm_model, glm_tokenizer
|
|
|
312 |
embedding_model = create_embedding_model(Embedding_Model)
|
313 |
vector_store = load_or_create_store(store_path, file_paths, embedding_model)
|
314 |
|
315 |
+
whisper_transcribe_model = whisper.load_model("base")
|
316 |
|
317 |
def clear_fn():
|
318 |
return [], [], '', '', '', None, None
|