Update app.py
Browse files
app.py
CHANGED
@@ -68,7 +68,7 @@ qdrant_client = QdrantClient(
|
|
68 |
|
69 |
print(qdrant_client.get_collections())
|
70 |
|
71 |
-
class
|
72 |
def __init__(self, temperature, model_name, api_key):
|
73 |
self.temperature = temperature
|
74 |
self.model_name = model_name
|
@@ -135,13 +135,13 @@ bnb_config = BitsAndBytesConfig(
|
|
135 |
load_in_8bit=True,
|
136 |
)
|
137 |
|
138 |
-
mistral_tokenizer = AutoTokenizer.from_pretrained(MODEL_PATH,
|
139 |
|
140 |
judge_llm = AutoModelForCausalLM.from_pretrained(
|
141 |
MODEL_PATH,
|
142 |
quantization_config=bnb_config,torch_dtype=torch.float16,
|
143 |
device_map="auto",
|
144 |
-
|
145 |
)
|
146 |
|
147 |
print(judge_llm.hf_device_map)
|
@@ -601,7 +601,7 @@ def eval_question_quality(
|
|
601 |
}
|
602 |
|
603 |
except Exception as e:
|
604 |
-
logging.error(f"Error in eval_question_quality: {type(e).
|
605 |
return {
|
606 |
"Score": "Poor",
|
607 |
"Reasoning": f"Critical error occurred: {str(e)}. Defaulted to 'Poor'.",
|
@@ -1459,13 +1459,15 @@ import json
|
|
1459 |
from moviepy.editor import VideoFileClip
|
1460 |
import shutil
|
1461 |
from transformers import BarkModel, AutoProcessor
|
1462 |
-
import torch
|
1463 |
import whisper
|
1464 |
from transformers import Wav2Vec2Processor, Wav2Vec2ForSequenceClassification
|
1465 |
import librosa
|
1466 |
|
1467 |
import torch
|
1468 |
print(torch.cuda.is_available()) # ✅ Tells you if GPU is available
|
|
|
|
|
1469 |
|
1470 |
|
1471 |
# Bark TTS
|
|
|
68 |
|
69 |
print(qdrant_client.get_collections())
|
70 |
|
71 |
+
class CustomChatGroq:
|
72 |
def __init__(self, temperature, model_name, api_key):
|
73 |
self.temperature = temperature
|
74 |
self.model_name = model_name
|
|
|
135 |
load_in_8bit=True,
|
136 |
)
|
137 |
|
138 |
+
mistral_tokenizer = AutoTokenizer.from_pretrained(MODEL_PATH,token=hf_api_key)
|
139 |
|
140 |
judge_llm = AutoModelForCausalLM.from_pretrained(
|
141 |
MODEL_PATH,
|
142 |
quantization_config=bnb_config,torch_dtype=torch.float16,
|
143 |
device_map="auto",
|
144 |
+
token=hf_api_key
|
145 |
)
|
146 |
|
147 |
print(judge_llm.hf_device_map)
|
|
|
601 |
}
|
602 |
|
603 |
except Exception as e:
|
604 |
+
logging.error(f"Error in eval_question_quality: {type(e).__name__}: {e}", exc_info=True)
|
605 |
return {
|
606 |
"Score": "Poor",
|
607 |
"Reasoning": f"Critical error occurred: {str(e)}. Defaulted to 'Poor'.",
|
|
|
1459 |
from moviepy.editor import VideoFileClip
|
1460 |
import shutil
|
1461 |
from transformers import BarkModel, AutoProcessor
|
1462 |
+
import torch, gc
|
1463 |
import whisper
|
1464 |
from transformers import Wav2Vec2Processor, Wav2Vec2ForSequenceClassification
|
1465 |
import librosa
|
1466 |
|
1467 |
import torch
|
1468 |
print(torch.cuda.is_available()) # ✅ Tells you if GPU is available
|
1469 |
+
torch.cuda.empty_cache()
|
1470 |
+
gc.collect()
|
1471 |
|
1472 |
|
1473 |
# Bark TTS
|