Upload folder using huggingface_hub
Browse files- __pycache__/__init__.cpython-311.pyc +0 -0
- __pycache__/ultravox_config.cpython-311.pyc +0 -0
- __pycache__/ultravox_model.cpython-311.pyc +0 -0
- __pycache__/ultravox_pipeline.cpython-311.pyc +0 -0
- __pycache__/ultravox_processing.cpython-311.pyc +0 -0
- __pycache__/wandb_utils.cpython-311.pyc +0 -0
- __pycache__/whisper_model_modified.cpython-311.pyc +0 -0
- ultravox_config.py +0 -3
- ultravox_model.py +8 -12
- ultravox_pipeline.py +2 -0
- ultravox_processing.py +1 -1
__pycache__/__init__.cpython-311.pyc
ADDED
|
Binary file (168 Bytes). View file
|
|
|
__pycache__/ultravox_config.cpython-311.pyc
ADDED
|
Binary file (6.63 kB). View file
|
|
|
__pycache__/ultravox_model.cpython-311.pyc
ADDED
|
Binary file (23.5 kB). View file
|
|
|
__pycache__/ultravox_pipeline.cpython-311.pyc
ADDED
|
Binary file (5.27 kB). View file
|
|
|
__pycache__/ultravox_processing.cpython-311.pyc
ADDED
|
Binary file (8.79 kB). View file
|
|
|
__pycache__/wandb_utils.cpython-311.pyc
ADDED
|
Binary file (1.02 kB). View file
|
|
|
__pycache__/whisper_model_modified.cpython-311.pyc
ADDED
|
Binary file (5.25 kB). View file
|
|
|
ultravox_config.py
CHANGED
|
@@ -139,6 +139,3 @@ class UltravoxConfig(transformers.PretrainedConfig):
|
|
| 139 |
self.initializer_range = self.text_config.initializer_range
|
| 140 |
|
| 141 |
super().__init__(**kwargs)
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
UltravoxConfig.register_for_auto_class()
|
|
|
|
| 139 |
self.initializer_range = self.text_config.initializer_range
|
| 140 |
|
| 141 |
super().__init__(**kwargs)
|
|
|
|
|
|
|
|
|
ultravox_model.py
CHANGED
|
@@ -11,8 +11,8 @@ import transformers.modeling_outputs
|
|
| 11 |
import transformers.models
|
| 12 |
|
| 13 |
# We must use relative import in this directory to allow uploading to HF Hub
|
|
|
|
| 14 |
from .ultravox_config import UltravoxConfig
|
| 15 |
-
from .ultravox_processing import UltravoxProcessor
|
| 16 |
from .whisper_model_modified import WhisperEncoder as ModifiedWhisperEncoder
|
| 17 |
|
| 18 |
|
|
@@ -188,10 +188,9 @@ class UltravoxModel(
|
|
| 188 |
return model_input
|
| 189 |
|
| 190 |
@classmethod
|
| 191 |
-
def _create_audio_tower(
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
]:
|
| 195 |
if config.audio_model_id is not None:
|
| 196 |
if "whisper" in config.audio_model_id is not None:
|
| 197 |
audio_tower = ModifiedWhisperEncoder.from_pretrained(
|
|
@@ -398,14 +397,11 @@ class UltravoxProjector(nn.Sequential):
|
|
| 398 |
return hidden_states
|
| 399 |
|
| 400 |
|
| 401 |
-
|
| 402 |
-
transformers.AutoModel.register(UltravoxConfig, UltravoxModel)
|
| 403 |
-
# transformers.AutoModelForCausalLM.register(
|
| 404 |
-
# UltravoxConfig, UltravoxModel
|
| 405 |
-
# )
|
| 406 |
UltravoxModel.register_for_auto_class()
|
| 407 |
-
transformers.AutoProcessor.register(UltravoxConfig, UltravoxProcessor)
|
| 408 |
-
# UltravoxModel.register_for_auto_class("AutoModelForCausalLM")
|
| 409 |
|
|
|
|
|
|
|
|
|
|
| 410 |
|
| 411 |
transformers.activations.ACT2FN["swiglu"] = SwiGLU
|
|
|
|
| 11 |
import transformers.models
|
| 12 |
|
| 13 |
# We must use relative import in this directory to allow uploading to HF Hub
|
| 14 |
+
# Even "from . import X" pattern doesn't work (undocumented and unclear why)
|
| 15 |
from .ultravox_config import UltravoxConfig
|
|
|
|
| 16 |
from .whisper_model_modified import WhisperEncoder as ModifiedWhisperEncoder
|
| 17 |
|
| 18 |
|
|
|
|
| 188 |
return model_input
|
| 189 |
|
| 190 |
@classmethod
|
| 191 |
+
def _create_audio_tower(
|
| 192 |
+
cls, config: UltravoxConfig
|
| 193 |
+
) -> Union[transformers.Wav2Vec2Model, ModifiedWhisperEncoder]:
|
|
|
|
| 194 |
if config.audio_model_id is not None:
|
| 195 |
if "whisper" in config.audio_model_id is not None:
|
| 196 |
audio_tower = ModifiedWhisperEncoder.from_pretrained(
|
|
|
|
| 397 |
return hidden_states
|
| 398 |
|
| 399 |
|
| 400 |
+
UltravoxConfig.register_for_auto_class()
|
|
|
|
|
|
|
|
|
|
|
|
|
| 401 |
UltravoxModel.register_for_auto_class()
|
|
|
|
|
|
|
| 402 |
|
| 403 |
+
transformers.AutoConfig.register("ultravox", UltravoxConfig)
|
| 404 |
+
transformers.AutoModel.register(UltravoxConfig, UltravoxModel)
|
| 405 |
+
# transformers.AutoProcessor.register(UltravoxConfig, UltravoxProcessor) # TODO: make processo work standalone
|
| 406 |
|
| 407 |
transformers.activations.ACT2FN["swiglu"] = SwiGLU
|
ultravox_pipeline.py
CHANGED
|
@@ -4,6 +4,7 @@ from typing import Any, Dict, List, Optional
|
|
| 4 |
import transformers
|
| 5 |
|
| 6 |
# We must use relative import in this directory to allow uploading to HF Hub
|
|
|
|
| 7 |
from .ultravox_model import UltravoxModel
|
| 8 |
from .ultravox_processing import UltravoxProcessor
|
| 9 |
|
|
@@ -104,5 +105,6 @@ class UltravoxPipeline(transformers.Pipeline):
|
|
| 104 |
transformers.pipelines.PIPELINE_REGISTRY.register_pipeline(
|
| 105 |
"ultravox-pipeline",
|
| 106 |
pipeline_class=UltravoxPipeline,
|
|
|
|
| 107 |
type="multimodal",
|
| 108 |
)
|
|
|
|
| 4 |
import transformers
|
| 5 |
|
| 6 |
# We must use relative import in this directory to allow uploading to HF Hub
|
| 7 |
+
# Even "from . import X" pattern doesn't work (undocumented and unclear why)
|
| 8 |
from .ultravox_model import UltravoxModel
|
| 9 |
from .ultravox_processing import UltravoxProcessor
|
| 10 |
|
|
|
|
| 105 |
transformers.pipelines.PIPELINE_REGISTRY.register_pipeline(
|
| 106 |
"ultravox-pipeline",
|
| 107 |
pipeline_class=UltravoxPipeline,
|
| 108 |
+
pt_model=transformers.AutoModel,
|
| 109 |
type="multimodal",
|
| 110 |
)
|
ultravox_processing.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
from typing import
|
| 2 |
|
| 3 |
import numpy as np
|
| 4 |
import torch
|
|
|
|
| 1 |
+
from typing import Optional, Union
|
| 2 |
|
| 3 |
import numpy as np
|
| 4 |
import torch
|