Text-to-Speech
Transformers
Safetensors
English
moss_tts_nano
feature-extraction
tts
moss-tts-nano
indian-english
lora
voice-cloning
custom_code
Instructions to use IOTEverythin/roxi-tts-v2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use IOTEverythin/roxi-tts-v2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-to-speech", model="IOTEverythin/roxi-tts-v2", trust_remote_code=True)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("IOTEverythin/roxi-tts-v2", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
fix: gracefully fall back flash_attention_2 -> sdpa when flash_attn not installed
Browse files- gpt2_decoder.py +4 -0
gpt2_decoder.py
CHANGED
|
@@ -99,6 +99,8 @@ class MossTTSNanoGPT2Attention(nn.Module):
|
|
| 99 |
self.head_dim = hidden_size // num_heads
|
| 100 |
self.embed_dim = hidden_size
|
| 101 |
self.layer_idx = layer_idx
|
|
|
|
|
|
|
| 102 |
self.attn_implementation = attn_implementation
|
| 103 |
self.attn_dropout = float(config.attn_pdrop)
|
| 104 |
self.resid_dropout = nn.Dropout(config.resid_pdrop)
|
|
@@ -388,6 +390,8 @@ class MossTTSNanoGPT2Model(nn.Module):
|
|
| 388 |
def __init__(self, config: GPT2Config, attn_implementation: str = "eager") -> None:
|
| 389 |
super().__init__()
|
| 390 |
self.config = config
|
|
|
|
|
|
|
| 391 |
self.attn_implementation = attn_implementation
|
| 392 |
self.position_embedding_type = str(getattr(config, "position_embedding_type", "absolute")).lower()
|
| 393 |
if self.position_embedding_type not in {"absolute", "rope"}:
|
|
|
|
| 99 |
self.head_dim = hidden_size // num_heads
|
| 100 |
self.embed_dim = hidden_size
|
| 101 |
self.layer_idx = layer_idx
|
| 102 |
+
if attn_implementation == "flash_attention_2" and not _FLASH_ATTN_AVAILABLE:
|
| 103 |
+
attn_implementation = "sdpa" # graceful fallback when flash_attn isn't installed
|
| 104 |
self.attn_implementation = attn_implementation
|
| 105 |
self.attn_dropout = float(config.attn_pdrop)
|
| 106 |
self.resid_dropout = nn.Dropout(config.resid_pdrop)
|
|
|
|
| 390 |
def __init__(self, config: GPT2Config, attn_implementation: str = "eager") -> None:
|
| 391 |
super().__init__()
|
| 392 |
self.config = config
|
| 393 |
+
if attn_implementation == "flash_attention_2" and not _FLASH_ATTN_AVAILABLE:
|
| 394 |
+
attn_implementation = "sdpa" # graceful fallback when flash_attn isn't installed
|
| 395 |
self.attn_implementation = attn_implementation
|
| 396 |
self.position_embedding_type = str(getattr(config, "position_embedding_type", "absolute")).lower()
|
| 397 |
if self.position_embedding_type not in {"absolute", "rope"}:
|