Rustamshry commited on
Commit
6aeb07d
·
verified ·
1 Parent(s): 1888642

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +56 -1
README.md CHANGED
@@ -1,6 +1,16 @@
1
  ---
2
  base_model: unsloth/csm-1b
3
  library_name: peft
 
 
 
 
 
 
 
 
 
 
4
  ---
5
 
6
  # Model Card for Model ID
@@ -71,7 +81,52 @@ Users (both direct and downstream) should be made aware of the risks, biases and
71
 
72
  Use the code below to get started with the model.
73
 
74
- [More Information Needed]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
 
76
  ## Training Details
77
 
 
1
  ---
2
  base_model: unsloth/csm-1b
3
  library_name: peft
4
+ license: mit
5
+ datasets:
6
+ - Dev372/Cardiology_Medical_STT_Dataset
7
+ language:
8
+ - en
9
+ pipeline_tag: text-to-speech
10
+ tags:
11
+ - cardiology
12
+ - medical
13
+ - transformers
14
  ---
15
 
16
  # Model Card for Model ID
 
81
 
82
  Use the code below to get started with the model.
83
 
84
+ ```python
85
+ import torch
86
+ from transformers import CsmForConditionalGeneration, AutoProcessor
87
+ import soundfile as sf
88
+ from peft import PeftModel
89
+
90
+
91
+ model_id = "unsloth/csm-1b"
92
+ device = "cuda" if torch.cuda.is_available() else "cpu"
93
+
94
+
95
+ processor = AutoProcessor.from_pretrained(model_id)
96
+ base_model = CsmForConditionalGeneration.from_pretrained(model_id, device_map=device)
97
+
98
+ model = PeftModel.from_pretrained(base_model, "khazarai/Cardiology-TTS")
99
+
100
+ text = "The coronary arteries are patent with no significant stenosis."
101
+
102
+ speaker_id = 0
103
+
104
+ conversation = [
105
+ {"role": str(speaker_id), "content": [{"type": "text", "text": text}]},
106
+ ]
107
+ audio_values = model.generate(
108
+ **processor.apply_chat_template(
109
+ conversation,
110
+ tokenize=True,
111
+ return_dict=True,
112
+ ).to("cuda"),
113
+ max_new_tokens=200,
114
+ # play with these parameters to tweak results
115
+ # depth_decoder_top_k=0,
116
+ # depth_decoder_top_p=0.9,
117
+ # depth_decoder_do_sample=True,
118
+ # depth_decoder_temperature=0.9,
119
+ # top_k=0,
120
+ # top_p=1.0,
121
+ # temperature=0.9,
122
+ # do_sample=True,
123
+ #########################################################
124
+ output_audio=True
125
+ )
126
+ audio = audio_values[0].to(torch.float32).cpu().numpy()
127
+ sf.write("example.wav", audio, 24000)
128
+
129
+ ```
130
 
131
  ## Training Details
132