Tanriders commited on
Commit
b89343f
1 Parent(s): 1d6a66d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +30 -3
app.py CHANGED
@@ -1,5 +1,32 @@
1
- git lfs install
 
2
 
3
- git clone https://huggingface.co/scb10x/llama-3-typhoon-v1.5-8b-audio-preview
4
 
5
- GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/scb10x/llama-3-typhoon-v1.5-8b-audio-preview
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use a pipeline as a high-level helper
2
+ from transformers import pipeline
3
 
4
+ pipe = pipeline("text-generation", model="scb10x/llama-3-typhoon-v1.5-8b-audio-preview", trust_remote_code=True)
5
 
6
+
7
+ from transformers import AutoModel
8
+
9
+ # Initialize from the trained model
10
+ model = AutoModel.from_pretrained(
11
+ "scb10x/llama-3-typhoon-v1.5-8b-audio-preview",
12
+ torch_dtype=torch.float16,
13
+ trust_remote_code=True
14
+ )
15
+ model.to("cuda")
16
+ model.eval()
17
+
18
+ # Run generation
19
+ prompt_pattern="<|begin_of_text|><|start_header_id|>user<|end_header_id|>\n\n<Speech><SpeechHere></Speech> {}<|eot_id|><|start_header_id|>assistant<|end_header_id|>\n\n"
20
+ response = model.generate(
21
+ wav_path="path_to_your_audio.wav",
22
+ prompt="transcribe this audio",
23
+ prompt_pattern=prompt_pattern,
24
+ do_sample=False,
25
+ max_length=1200,
26
+ repetition_penalty=1.1,
27
+ num_beams=1,
28
+ # temperature=0.4,
29
+ # top_p=0.9,
30
+ # streamer=streamer # supports TextIteratorStreamer
31
+ )
32
+ print(response)