Update app.py
Browse files
app.py
CHANGED
@@ -23,22 +23,7 @@ transcriber = pipeline(
|
|
23 |
device=0 if torch.cuda.is_available() else "cpu",
|
24 |
)
|
25 |
|
26 |
-
# LLaMA Model Optimization
|
27 |
-
LLAMA = "meta-llama/Llama-3.2-3B-Instruct"
|
28 |
-
llama_quant_config = BitsAndBytesConfig(
|
29 |
-
load_in_4bit=True,
|
30 |
-
bnb_4bit_use_double_quant=True,
|
31 |
-
bnb_4bit_compute_dtype=torch.bfloat16,
|
32 |
-
bnb_4bit_quant_type="nf4"
|
33 |
-
)
|
34 |
|
35 |
-
tokenizer = AutoTokenizer.from_pretrained(LLAMA)
|
36 |
-
tokenizer.pad_token = tokenizer.eos_token
|
37 |
-
model = AutoModelForCausalLM.from_pretrained(
|
38 |
-
LLAMA,
|
39 |
-
torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32,
|
40 |
-
device_map="auto"
|
41 |
-
)
|
42 |
|
43 |
# Function to Transcribe & Generate Minutes
|
44 |
def process_audio(audio_file):
|
@@ -49,6 +34,22 @@ def process_audio(audio_file):
|
|
49 |
transcript = transcriber(audio_file)["text"]
|
50 |
del transcriber
|
51 |
del processor
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
# Generate meeting minutes
|
53 |
system_message = "You are an assistant that produces minutes of meetings from transcripts, with summary, key discussion points, takeaways and action items with owners, in markdown."
|
54 |
user_prompt = f"Below is an extract transcript of a Denver council meeting. Please write minutes in markdown, including a summary with attendees, location and date; discussion points; takeaways; and action items with owners.\n{transcript}"
|
|
|
23 |
device=0 if torch.cuda.is_available() else "cpu",
|
24 |
)
|
25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
|
28 |
# Function to Transcribe & Generate Minutes
|
29 |
def process_audio(audio_file):
|
|
|
34 |
transcript = transcriber(audio_file)["text"]
|
35 |
del transcriber
|
36 |
del processor
|
37 |
+
# LLaMA Model Optimization
|
38 |
+
LLAMA = "meta-llama/Llama-3.2-3B-Instruct"
|
39 |
+
llama_quant_config = BitsAndBytesConfig(
|
40 |
+
load_in_4bit=True,
|
41 |
+
bnb_4bit_use_double_quant=True,
|
42 |
+
bnb_4bit_compute_dtype=torch.bfloat16,
|
43 |
+
bnb_4bit_quant_type="nf4"
|
44 |
+
)
|
45 |
+
|
46 |
+
tokenizer = AutoTokenizer.from_pretrained(LLAMA)
|
47 |
+
tokenizer.pad_token = tokenizer.eos_token
|
48 |
+
model = AutoModelForCausalLM.from_pretrained(
|
49 |
+
LLAMA,
|
50 |
+
torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32,
|
51 |
+
device_map="auto"
|
52 |
+
)
|
53 |
# Generate meeting minutes
|
54 |
system_message = "You are an assistant that produces minutes of meetings from transcripts, with summary, key discussion points, takeaways and action items with owners, in markdown."
|
55 |
user_prompt = f"Below is an extract transcript of a Denver council meeting. Please write minutes in markdown, including a summary with attendees, location and date; discussion points; takeaways; and action items with owners.\n{transcript}"
|