Helw150
commited on
Commit
•
cd5984d
1
Parent(s):
c583d87
Try and get this custom stuff working
Browse files- __init__.py +0 -0
- modeling_diva.py +4 -2
__init__.py
ADDED
File without changes
|
modeling_diva.py
CHANGED
@@ -11,11 +11,11 @@ import torch.nn.functional as F
|
|
11 |
from datasets import Audio
|
12 |
from safetensors.torch import load, load_model
|
13 |
from torch import nn
|
|
|
14 |
from transformers import (
|
15 |
AutoProcessor,
|
16 |
AutoTokenizer,
|
17 |
LlamaForCausalLM,
|
18 |
-
PretrainedConfig,
|
19 |
PreTrainedModel,
|
20 |
WhisperForConditionalGeneration,
|
21 |
)
|
@@ -44,10 +44,12 @@ class WhisperConnector(nn.Module):
|
|
44 |
|
45 |
|
46 |
class DiVAModel(PreTrainedModel):
|
|
|
|
|
47 |
def __init__(
|
48 |
self, via_path=None, config_dict={}, device_map=None, speech_encoder_device=None
|
49 |
):
|
50 |
-
super().__init__(
|
51 |
if speech_encoder_device is None:
|
52 |
speech_encoder_device = "cuda:0"
|
53 |
whisper = WhisperForConditionalGeneration.from_pretrained(
|
|
|
11 |
from datasets import Audio
|
12 |
from safetensors.torch import load, load_model
|
13 |
from torch import nn
|
14 |
+
from .configuring_diva import DiVAConfig
|
15 |
from transformers import (
|
16 |
AutoProcessor,
|
17 |
AutoTokenizer,
|
18 |
LlamaForCausalLM,
|
|
|
19 |
PreTrainedModel,
|
20 |
WhisperForConditionalGeneration,
|
21 |
)
|
|
|
44 |
|
45 |
|
46 |
class DiVAModel(PreTrainedModel):
|
47 |
+
config_class = DiVAConfig
|
48 |
+
|
49 |
def __init__(
|
50 |
self, via_path=None, config_dict={}, device_map=None, speech_encoder_device=None
|
51 |
):
|
52 |
+
super().__init__(DiVAConfig.from_dict(config_dict))
|
53 |
if speech_encoder_device is None:
|
54 |
speech_encoder_device = "cuda:0"
|
55 |
whisper = WhisperForConditionalGeneration.from_pretrained(
|