Video-Text-to-Text
Transformers
Safetensors
English
Chinese
moss_vl
feature-extraction
Base
Video-Understanding
Image-Understanding
MOSS-VL
OpenMOSS
multimodal
video
vision-language
custom_code
Instructions to use OpenMOSS-Team/MOSS-VL-Base-0408 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use OpenMOSS-Team/MOSS-VL-Base-0408 with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("OpenMOSS-Team/MOSS-VL-Base-0408", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Unify modeling/configuration/tokenizer with the 0708 standard (transformers 4.57 compatible, includes query RoPE fix)
Browse files- configuration_moss_vl.py +4 -28
- modeling_moss_vl.py +0 -0
- tokenizer.json +2 -2
- tokenizer_config.json +19 -1
configuration_moss_vl.py
CHANGED
|
@@ -69,8 +69,6 @@ class MossVLTextConfig(PretrainedConfig):
|
|
| 69 |
|
| 70 |
model_type = "moss_vl_text"
|
| 71 |
base_config_key = "text_config"
|
| 72 |
-
default_theta = 5000000.0
|
| 73 |
-
ignore_keys_at_rope_validation = {"mrope_section", "mrope_interleaved"}
|
| 74 |
|
| 75 |
def __init__(
|
| 76 |
self,
|
|
@@ -88,11 +86,9 @@ class MossVLTextConfig(PretrainedConfig):
|
|
| 88 |
use_cache=True,
|
| 89 |
tie_word_embeddings=False,
|
| 90 |
rope_theta=5000000.0,
|
| 91 |
-
rope_parameters=None,
|
| 92 |
rope_scaling=None,
|
| 93 |
attention_bias=False,
|
| 94 |
attention_dropout=0.0,
|
| 95 |
-
pad_token_id=None,
|
| 96 |
# Cross attention specific
|
| 97 |
cross_attention_layers=None, # List of layer indices to insert cross attention
|
| 98 |
**kwargs,
|
|
@@ -116,31 +112,11 @@ class MossVLTextConfig(PretrainedConfig):
|
|
| 116 |
self.rms_norm_eps = rms_norm_eps
|
| 117 |
self.use_cache = use_cache
|
| 118 |
self.rope_theta = rope_theta
|
| 119 |
-
|
| 120 |
-
if rope_scaling is not None:
|
| 121 |
-
rope_parameters = dict(rope_scaling)
|
| 122 |
-
else:
|
| 123 |
-
rope_parameters = {"rope_type": "default"}
|
| 124 |
-
else:
|
| 125 |
-
rope_parameters = dict(rope_parameters)
|
| 126 |
-
|
| 127 |
-
if "type" in rope_parameters and "rope_type" not in rope_parameters:
|
| 128 |
-
rope_parameters["rope_type"] = rope_parameters.pop("type")
|
| 129 |
-
rope_parameters.setdefault("rope_type", "default")
|
| 130 |
-
rope_parameters.setdefault("rope_theta", rope_theta)
|
| 131 |
-
|
| 132 |
-
self.rope_parameters = rope_parameters
|
| 133 |
-
self.rope_scaling = rope_scaling if rope_scaling is not None else dict(rope_parameters)
|
| 134 |
self.attention_bias = attention_bias
|
| 135 |
self.attention_dropout = attention_dropout
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
if hasattr(self, "standardize_rope_params"):
|
| 139 |
-
self.standardize_rope_params()
|
| 140 |
-
if hasattr(self, "validate_rope"):
|
| 141 |
-
self.validate_rope()
|
| 142 |
-
else:
|
| 143 |
-
rope_config_validation(self, ignore_keys=self.ignore_keys_at_rope_validation)
|
| 144 |
self.cross_attention_layers = cross_attention_layers or [2, 6, 10, 14, 18, 22, 26, 30, 34, 38, 42, 46]
|
| 145 |
super().__init__(tie_word_embeddings=tie_word_embeddings, **kwargs)
|
| 146 |
|
|
@@ -185,4 +161,4 @@ class MossVLConfig(PretrainedConfig):
|
|
| 185 |
super().__init__(**kwargs, tie_word_embeddings=tie_word_embeddings)
|
| 186 |
|
| 187 |
|
| 188 |
-
__all__ = ["MossVLConfig", "MossVLTextConfig"]
|
|
|
|
| 69 |
|
| 70 |
model_type = "moss_vl_text"
|
| 71 |
base_config_key = "text_config"
|
|
|
|
|
|
|
| 72 |
|
| 73 |
def __init__(
|
| 74 |
self,
|
|
|
|
| 86 |
use_cache=True,
|
| 87 |
tie_word_embeddings=False,
|
| 88 |
rope_theta=5000000.0,
|
|
|
|
| 89 |
rope_scaling=None,
|
| 90 |
attention_bias=False,
|
| 91 |
attention_dropout=0.0,
|
|
|
|
| 92 |
# Cross attention specific
|
| 93 |
cross_attention_layers=None, # List of layer indices to insert cross attention
|
| 94 |
**kwargs,
|
|
|
|
| 112 |
self.rms_norm_eps = rms_norm_eps
|
| 113 |
self.use_cache = use_cache
|
| 114 |
self.rope_theta = rope_theta
|
| 115 |
+
self.rope_scaling = rope_scaling
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 116 |
self.attention_bias = attention_bias
|
| 117 |
self.attention_dropout = attention_dropout
|
| 118 |
+
|
| 119 |
+
rope_config_validation(self, ignore_keys={"mrope_section", "mrope_interleaved"})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 120 |
self.cross_attention_layers = cross_attention_layers or [2, 6, 10, 14, 18, 22, 26, 30, 34, 38, 42, 46]
|
| 121 |
super().__init__(tie_word_embeddings=tie_word_embeddings, **kwargs)
|
| 122 |
|
|
|
|
| 161 |
super().__init__(**kwargs, tie_word_embeddings=tie_word_embeddings)
|
| 162 |
|
| 163 |
|
| 164 |
+
__all__ = ["MossVLConfig", "MossVLTextConfig"]
|
modeling_moss_vl.py
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer.json
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e7bbd0f9784004df51aca562befc3c7a8f294b4045aa8685536c35804c9aa493
|
| 3 |
+
size 11423411
|
tokenizer_config.json
CHANGED
|
@@ -225,6 +225,22 @@
|
|
| 225 |
"rstrip": false,
|
| 226 |
"single_word": false,
|
| 227 |
"special": true
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 228 |
}
|
| 229 |
},
|
| 230 |
"additional_special_tokens": [
|
|
@@ -242,7 +258,9 @@
|
|
| 242 |
"<|image_pad|>",
|
| 243 |
"<|video_pad|>",
|
| 244 |
"<|time_start|>",
|
| 245 |
-
"<|time_end|>"
|
|
|
|
|
|
|
| 246 |
],
|
| 247 |
"bos_token": null,
|
| 248 |
"clean_up_tokenization_spaces": false,
|
|
|
|
| 225 |
"rstrip": false,
|
| 226 |
"single_word": false,
|
| 227 |
"special": true
|
| 228 |
+
},
|
| 229 |
+
"151671": {
|
| 230 |
+
"content": "<|silence|>",
|
| 231 |
+
"lstrip": false,
|
| 232 |
+
"normalized": false,
|
| 233 |
+
"rstrip": false,
|
| 234 |
+
"single_word": false,
|
| 235 |
+
"special": true
|
| 236 |
+
},
|
| 237 |
+
"151672": {
|
| 238 |
+
"content": "<|response|>",
|
| 239 |
+
"lstrip": false,
|
| 240 |
+
"normalized": false,
|
| 241 |
+
"rstrip": false,
|
| 242 |
+
"single_word": false,
|
| 243 |
+
"special": true
|
| 244 |
}
|
| 245 |
},
|
| 246 |
"additional_special_tokens": [
|
|
|
|
| 258 |
"<|image_pad|>",
|
| 259 |
"<|video_pad|>",
|
| 260 |
"<|time_start|>",
|
| 261 |
+
"<|time_end|>",
|
| 262 |
+
"<|silence|>",
|
| 263 |
+
"<|response|>"
|
| 264 |
],
|
| 265 |
"bos_token": null,
|
| 266 |
"clean_up_tokenization_spaces": false,
|