PATTARA TIPAKSORN
commited on
Update README.md
Browse files
README.md
CHANGED
@@ -35,18 +35,19 @@ import torch
|
|
35 |
import librosa
|
36 |
from transformers import AutoModel
|
37 |
|
38 |
-
device = "cuda"
|
|
|
39 |
|
40 |
model = AutoModel.from_pretrained(
|
41 |
"nectec/Pathumma-llm-audio-1.0.0",
|
42 |
-
torch_dtype=torch.bfloat16,
|
43 |
lora_infer_mode=True,
|
44 |
-
init_from_scratch=True,
|
45 |
trust_remote_code=True
|
46 |
)
|
47 |
model = model.to(device)
|
48 |
|
49 |
-
prompt = "
|
50 |
audio_path = "audio_path.wav"
|
51 |
audio, sr = librosa.load(audio_path, sr=16000)
|
52 |
|
|
|
35 |
import librosa
|
36 |
from transformers import AutoModel
|
37 |
|
38 |
+
device = "cuda" if torch.cuda.is_available() else "cpu"
|
39 |
+
torch_dtype = torch.bfloat16 if torch.cuda.is_available() else torch.float32
|
40 |
|
41 |
model = AutoModel.from_pretrained(
|
42 |
"nectec/Pathumma-llm-audio-1.0.0",
|
43 |
+
torch_dtype=torch.bfloat16,
|
44 |
lora_infer_mode=True,
|
45 |
+
init_from_scratch=True,
|
46 |
trust_remote_code=True
|
47 |
)
|
48 |
model = model.to(device)
|
49 |
|
50 |
+
prompt = "ถอดเสียงเป็นข้อความ"
|
51 |
audio_path = "audio_path.wav"
|
52 |
audio, sr = librosa.load(audio_path, sr=16000)
|
53 |
|