Instructions to use fixie-ai/ultravox-v0_5-llama-3_2-1b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use fixie-ai/ultravox-v0_5-llama-3_2-1b with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("fixie-ai/ultravox-v0_5-llama-3_2-1b", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
ensure BC with v4
Browse files- ultravox_model.py +10 -2
ultravox_model.py
CHANGED
|
@@ -427,7 +427,11 @@ class UltravoxModel(transformers.LlamaPreTrainedModel, GenerationMixin):
|
|
| 427 |
# But potentially other kwargs can be passed in. TODO
|
| 428 |
kwargs = {"torch_dtype": config.torch_dtype}
|
| 429 |
_default_device = getattr(torch, "get_default_device", lambda: None)()
|
| 430 |
-
_is_init =
|
|
|
|
|
|
|
|
|
|
|
|
|
| 431 |
if (
|
| 432 |
_is_init
|
| 433 |
and config.audio_model_id is not None
|
|
@@ -483,7 +487,11 @@ class UltravoxModel(transformers.LlamaPreTrainedModel, GenerationMixin):
|
|
| 483 |
cls, config: UltravoxConfig
|
| 484 |
) -> transformers.LlamaForCausalLM:
|
| 485 |
_default_device = getattr(torch, "get_default_device", lambda: None)()
|
| 486 |
-
_is_init =
|
|
|
|
|
|
|
|
|
|
|
|
|
| 487 |
if (
|
| 488 |
_is_init
|
| 489 |
and config.text_model_id is not None
|
|
|
|
| 427 |
# But potentially other kwargs can be passed in. TODO
|
| 428 |
kwargs = {"torch_dtype": config.torch_dtype}
|
| 429 |
_default_device = getattr(torch, "get_default_device", lambda: None)()
|
| 430 |
+
_is_init = (
|
| 431 |
+
(hasattr(transformers.modeling_utils, "_init_weights") and transformers.modeling_utils._init_weights)
|
| 432 |
+
or _default_device is None
|
| 433 |
+
or _default_device.type != "meta"
|
| 434 |
+
)
|
| 435 |
if (
|
| 436 |
_is_init
|
| 437 |
and config.audio_model_id is not None
|
|
|
|
| 487 |
cls, config: UltravoxConfig
|
| 488 |
) -> transformers.LlamaForCausalLM:
|
| 489 |
_default_device = getattr(torch, "get_default_device", lambda: None)()
|
| 490 |
+
_is_init = (
|
| 491 |
+
(hasattr(transformers.modeling_utils, "_init_weights") and transformers.modeling_utils._init_weights)
|
| 492 |
+
or _default_device is None
|
| 493 |
+
or _default_device.type != "meta"
|
| 494 |
+
)
|
| 495 |
if (
|
| 496 |
_is_init
|
| 497 |
and config.text_model_id is not None
|