Audio-Text-to-Text
Transformers
Safetensors
English
Korean
fastslm
feature-extraction
audio
text-generation
custom_code
Eval Results
Instructions to use okestro-ai-lab/FastSLM with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use okestro-ai-lab/FastSLM with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("okestro-ai-lab/FastSLM", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Update modeling_fastslm.py
Browse files- modeling_fastslm.py +3 -1
modeling_fastslm.py
CHANGED
|
@@ -289,7 +289,7 @@ class SpeechEncoder(nn.Module):
|
|
| 289 |
class FastSLMPreTrainedModel(PreTrainedModel):
|
| 290 |
config_class = FastSLMConfig
|
| 291 |
base_model_prefix = "fastslm"
|
| 292 |
-
|
| 293 |
def _init_weights(self, module):
|
| 294 |
if isinstance(module, nn.Linear):
|
| 295 |
nn.init.normal_(module.weight, std=0.02)
|
|
@@ -326,6 +326,8 @@ class FastSLMForConditionalGeneration(FastSLMPreTrainedModel, GenerationMixin):
|
|
| 326 |
language_token = [f"<|{lang.upper()}|>" for lang in LANGUAGES]
|
| 327 |
special_tokens = audio_token + language_token + task_token
|
| 328 |
self.tokenizer.add_special_tokens({"additional_special_tokens": special_tokens})
|
|
|
|
|
|
|
| 329 |
|
| 330 |
def get_input_embeddings(self) -> nn.Module:
|
| 331 |
"""Returns the input embedding layer of the LLM."""
|
|
|
|
| 289 |
class FastSLMPreTrainedModel(PreTrainedModel):
|
| 290 |
config_class = FastSLMConfig
|
| 291 |
base_model_prefix = "fastslm"
|
| 292 |
+
self.post_init()
|
| 293 |
def _init_weights(self, module):
|
| 294 |
if isinstance(module, nn.Linear):
|
| 295 |
nn.init.normal_(module.weight, std=0.02)
|
|
|
|
| 326 |
language_token = [f"<|{lang.upper()}|>" for lang in LANGUAGES]
|
| 327 |
special_tokens = audio_token + language_token + task_token
|
| 328 |
self.tokenizer.add_special_tokens({"additional_special_tokens": special_tokens})
|
| 329 |
+
|
| 330 |
+
self.post_init()
|
| 331 |
|
| 332 |
def get_input_embeddings(self) -> nn.Module:
|
| 333 |
"""Returns the input embedding layer of the LLM."""
|