MahmoodAnaam commited on
Commit
637209e
·
verified ·
1 Parent(s): 85d1fc5

Training in progress, step 1000

Browse files
config.json ADDED
@@ -0,0 +1,225 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "MSPVisualForCTC"
4
+ ],
5
+ "auto_map": {
6
+ "AutoConfig": "configuration_msp_visual.MSPVisualConfig",
7
+ "AutoModelForCTC": "modeling_msp_visual.MSPVisualForCTC"
8
+ },
9
+ "bos_token_id": 1,
10
+ "ctc_loss_reduction": "mean",
11
+ "ctc_zero_infinity": true,
12
+ "dtype": "float32",
13
+ "eos_token_id": 2,
14
+ "final_dropout": 0.1,
15
+ "model_type": "msp_visual",
16
+ "pad_token_id": 0,
17
+ "transformers_version": "5.10.2",
18
+ "use_cache": false,
19
+ "visual_config": {
20
+ "_name_or_path": "MahmoodAnaam/avhubert_encoder_large_noise_pt_noise_ft_433h-V0",
21
+ "a_upsample_ratio": 1,
22
+ "activation_dropout": 0.0,
23
+ "activation_function": "relu",
24
+ "adapter_attn_dim": null,
25
+ "adapter_kernel_size": 3,
26
+ "adapter_stride": 2,
27
+ "add_adapter": false,
28
+ "adim": 1024,
29
+ "aheads": 12,
30
+ "apply_spec_augment": true,
31
+ "architectures": [
32
+ "AVHubertModel"
33
+ ],
34
+ "attention_dropout": 0.1,
35
+ "audio_dropout": 0.5,
36
+ "audio_feat_dim": 104,
37
+ "auto_map": {
38
+ "AutoConfig": "configuration_avhubert.AVHubertConfig",
39
+ "AutoModel": "modeling_avhubert.AVHubertModel"
40
+ },
41
+ "bos_token_id": 1,
42
+ "classifier_proj_size": 256,
43
+ "cnn_module_kernel": 31,
44
+ "codevector_dim": 256,
45
+ "contrastive_logits_temperature": 0.1,
46
+ "conv_bias": false,
47
+ "conv_channels": 1024,
48
+ "conv_dim": [
49
+ 512,
50
+ 512,
51
+ 512,
52
+ 512,
53
+ 512,
54
+ 512,
55
+ 512
56
+ ],
57
+ "conv_kernel": [
58
+ 10,
59
+ 3,
60
+ 3,
61
+ 3,
62
+ 3,
63
+ 2,
64
+ 2
65
+ ],
66
+ "conv_kernel_sizes": [
67
+ 5,
68
+ 5
69
+ ],
70
+ "conv_stride": [
71
+ 5,
72
+ 2,
73
+ 2,
74
+ 2,
75
+ 2,
76
+ 2,
77
+ 2
78
+ ],
79
+ "ctc_loss_reduction": "sum",
80
+ "ctc_type": "builtin",
81
+ "ctc_zero_infinity": false,
82
+ "d_model": 1024,
83
+ "ddim": 1024,
84
+ "decoder_attention_heads": 8,
85
+ "decoder_ffn_dim": 4096,
86
+ "decoder_layerdrop": 0.0,
87
+ "decoder_layers": 9,
88
+ "decoder_start_token_id": 2,
89
+ "dheads": 16,
90
+ "diversity_loss_weight": 0.1,
91
+ "dlayers": 6,
92
+ "do_stable_layer_norm": false,
93
+ "dropout": 0.1,
94
+ "dropout_features": 0.1,
95
+ "dropout_input": 0.1,
96
+ "dropout_rate": 0.1,
97
+ "dtype": "float32",
98
+ "dunits": 3072,
99
+ "elayers": 12,
100
+ "encoder_attention_heads": 16,
101
+ "encoder_embed_dim": 1024,
102
+ "encoder_ffn_dim": 2048,
103
+ "encoder_layerdrop": 0.0,
104
+ "encoder_layers": 12,
105
+ "eos_token_id": 2,
106
+ "eunits": 3072,
107
+ "feat_extract_activation": "gelu",
108
+ "feat_extract_norm": "group",
109
+ "feat_proj_dropout": 0.1,
110
+ "feat_quantizer_dropout": 0.0,
111
+ "feature_grad_mult": 0.1,
112
+ "final_dim": 256,
113
+ "final_dropout": 0.0,
114
+ "freeze_feat_extract_train": true,
115
+ "fusion_hdim": 8192,
116
+ "fusion_norm": "batchnorm",
117
+ "hidden_act": "gelu",
118
+ "hidden_dropout": 0.1,
119
+ "hidden_size": 1024,
120
+ "init_std": 0.02,
121
+ "initializer_range": 0.02,
122
+ "input_channels": 1,
123
+ "input_feat_per_channel": 80,
124
+ "intermediate_size": 4096,
125
+ "label_rate": 25,
126
+ "layer_norm_eps": 1e-05,
127
+ "layerdrop": 0.0,
128
+ "logit_temp": 0.1,
129
+ "lsm_weight": 0.1,
130
+ "macaron_style": true,
131
+ "mask_channel_length": 10,
132
+ "mask_channel_min_space": 1,
133
+ "mask_channel_other": 0.0,
134
+ "mask_channel_prob": 0.0,
135
+ "mask_channel_selection": "static",
136
+ "mask_feature_length": 10,
137
+ "mask_feature_min_masks": 0,
138
+ "mask_feature_prob": 0.0,
139
+ "mask_length_audio": 10,
140
+ "mask_length_image": 5,
141
+ "mask_min_space": 1,
142
+ "mask_other": 0.0,
143
+ "mask_prob_audio": 0.8,
144
+ "mask_prob_image": 0.3,
145
+ "mask_selection": "static",
146
+ "mask_time_length": 10,
147
+ "mask_time_min_masks": 2,
148
+ "mask_time_min_space": 1,
149
+ "mask_time_other": 0.0,
150
+ "mask_time_prob": 0.0,
151
+ "mask_time_selection": "static",
152
+ "masking_type": "input",
153
+ "max_source_positions": 6000,
154
+ "max_target_positions": 2048,
155
+ "modality": "av",
156
+ "modality_dropout": 0.5,
157
+ "modality_fuse": "concat",
158
+ "model_type": "avhubert",
159
+ "mtlalpha": 0.1,
160
+ "no_mask_channel_overlap": false,
161
+ "no_mask_overlap": false,
162
+ "no_mask_time_overlap": false,
163
+ "num_adapter_layers": 3,
164
+ "num_attention_heads": 16,
165
+ "num_classes": 2004,
166
+ "num_codevector_groups": 2,
167
+ "num_codevectors_per_group": 320,
168
+ "num_conv_layers": 2,
169
+ "num_conv_pos_embedding_groups": 16,
170
+ "num_conv_pos_embeddings": 128,
171
+ "num_dictionaries": 1,
172
+ "num_feat_extract_layers": 7,
173
+ "num_hidden_layers": 24,
174
+ "num_negatives": 100,
175
+ "odim": 5049,
176
+ "output_hidden_size": 1024,
177
+ "pad_token_id": 1,
178
+ "proj_codevector_dim": 256,
179
+ "rel_pos_type": "latest",
180
+ "relu_type": "swish",
181
+ "resnet_relu_type": "prelu",
182
+ "resnet_weights": null,
183
+ "sample_rate": 25,
184
+ "scale_embedding": null,
185
+ "selection_type": "same_seq",
186
+ "sim_type": "cosine",
187
+ "skip_masked": false,
188
+ "skip_nomask": false,
189
+ "sub_encoder_layers": 0,
190
+ "target_glu": false,
191
+ "tdnn_dilation": [
192
+ 1,
193
+ 2,
194
+ 3,
195
+ 1,
196
+ 1
197
+ ],
198
+ "tdnn_dim": [
199
+ 512,
200
+ 512,
201
+ 512,
202
+ 512,
203
+ 1500
204
+ ],
205
+ "tdnn_kernel": [
206
+ 5,
207
+ 3,
208
+ 3,
209
+ 1,
210
+ 1
211
+ ],
212
+ "transformer_attn_dropout_rate": 0.1,
213
+ "transformer_encoder_attn_layer_type": "rel_mha",
214
+ "transformer_input_layer": "conv3d",
215
+ "transformer_length_normalized_loss": false,
216
+ "untie_final_proj": true,
217
+ "use_cache": true,
218
+ "use_cnn_module": true,
219
+ "use_weighted_layer_sum": false,
220
+ "vocab_size": 1000,
221
+ "xvector_output_dim": 512,
222
+ "zero_triu": false
223
+ },
224
+ "vocab_size": 32
225
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:31fb72fdc8486e5bc15d8553377fd6815a52b544e0553e7d15dbae5cea26a648
3
+ size 1300783936
processing_msp_visual.py ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers.processing_utils import ProcessorMixin
2
+
3
+
4
+ class MSPVisualProcessor(ProcessorMixin):
5
+ attributes = ["video_processor", "tokenizer"]
6
+ video_processor_class = "MSPVisualVideoProcessor"
7
+ tokenizer_class = "AutoTokenizer"
8
+
9
+ def __init__(self, video_processor=None, tokenizer=None, **kwargs):
10
+ super().__init__(video_processor, tokenizer, **kwargs)
11
+ self.video_processor = video_processor
12
+ self.tokenizer = tokenizer
13
+
14
+ def __call__(self, videos=None, text=None, **kwargs):
15
+ if videos is None and text is None:
16
+ raise ValueError("Provide at least one of videos or text.")
17
+ inputs = super().__call__(
18
+ images=None, audio=None, videos=videos, text=text, **kwargs
19
+ )
20
+
21
+ if "input_ids" in inputs:
22
+ inputs["labels"] = inputs.pop("input_ids")
23
+
24
+ return inputs
25
+
26
+ @property
27
+ def model_input_names(self) -> list[str]:
28
+ return ["pixel_values_videos", "padding_mask_videos", "labels"]
processor_config.json ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "auto_map": {
3
+ "AutoProcessor": "processing_msp_visual.MSPVisualProcessor"
4
+ },
5
+ "processor_class": "MSPVisualProcessor",
6
+ "video_processor": {
7
+ "auto_map": {
8
+ "AutoProcessor": "processing_msp_visual.MSPVisualProcessor",
9
+ "AutoVideoProcessor": "video_processing_msp_visual.MSPVisualVideoProcessor"
10
+ },
11
+ "crop_size": {
12
+ "height": 88,
13
+ "width": 88
14
+ },
15
+ "do_center_crop": true,
16
+ "do_convert_rgb_to_grayscale": true,
17
+ "do_normalize": true,
18
+ "do_rescale": true,
19
+ "do_resize": true,
20
+ "image_mean": 0.421,
21
+ "image_std": 0.165,
22
+ "resample": 2,
23
+ "rescale_factor": 0.00392156862745098,
24
+ "return_metadata": false,
25
+ "size": {
26
+ "height": 96,
27
+ "width": 96
28
+ },
29
+ "video_processor_type": "MSPVisualVideoProcessor"
30
+ }
31
+ }
runs/Jul05_01-50-22_cdfd359d8cce/events.out.tfevents.1783216222.cdfd359d8cce.8290.0 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1b5726ddea983bed10150dc93fc36058e5927583e69c9c355132d88b23b4f0ca
3
+ size 17762
tokenizer_config.json ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "added_tokens_decoder": {
3
+ "0": {
4
+ "content": "<pad>",
5
+ "lstrip": true,
6
+ "normalized": false,
7
+ "rstrip": true,
8
+ "single_word": false,
9
+ "special": false
10
+ },
11
+ "1": {
12
+ "content": "<s>",
13
+ "lstrip": true,
14
+ "normalized": false,
15
+ "rstrip": true,
16
+ "single_word": false,
17
+ "special": false
18
+ },
19
+ "2": {
20
+ "content": "</s>",
21
+ "lstrip": true,
22
+ "normalized": false,
23
+ "rstrip": true,
24
+ "single_word": false,
25
+ "special": false
26
+ },
27
+ "3": {
28
+ "content": "<unk>",
29
+ "lstrip": true,
30
+ "normalized": false,
31
+ "rstrip": true,
32
+ "single_word": false,
33
+ "special": false
34
+ },
35
+ "4": {
36
+ "content": "|",
37
+ "lstrip": false,
38
+ "normalized": false,
39
+ "rstrip": false,
40
+ "single_word": false,
41
+ "special": true
42
+ }
43
+ },
44
+ "auto_map": {
45
+ "AutoProcessor": "processing_msp_visual.MSPVisualProcessor"
46
+ },
47
+ "backend": "custom",
48
+ "bos_token": "<s>",
49
+ "do_lower_case": false,
50
+ "eos_token": "</s>",
51
+ "is_local": false,
52
+ "local_files_only": false,
53
+ "model_max_length": 1000000000000000019884624838656,
54
+ "model_specific_special_tokens": {
55
+ "word_delimiter_token": "|"
56
+ },
57
+ "pad_token": "<pad>",
58
+ "processor_class": "MSPVisualProcessor",
59
+ "replace_word_delimiter_char": " ",
60
+ "target_lang": null,
61
+ "tokenizer_class": "Wav2Vec2CTCTokenizer",
62
+ "unk_token": "<unk>",
63
+ "word_delimiter_token": "|"
64
+ }
training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ea7fce6a33cd52626ca2d7dd4a36749ff97abca33a7216c82c5b5e39a08f3350
3
+ size 5265
video_processing_msp_visual.py ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ import torchvision.transforms.v2.functional as tvF
3
+ from torchcodec.decoders import VideoDecoder
4
+ from transformers.image_processing_utils import BatchFeature
5
+ from transformers.image_utils import PILImageResampling
6
+ from transformers.processing_utils import Unpack, VideosKwargs
7
+ from transformers.video_processing_utils import BaseVideoProcessor, VideoMetadata
8
+ from transformers.video_utils import VideoInput
9
+
10
+
11
+ class MSPVisualVideoProcessor(BaseVideoProcessor):
12
+ resample = PILImageResampling.BILINEAR
13
+
14
+ def __init__(
15
+ self,
16
+ do_convert_rgb_to_grayscale: bool = True,
17
+ do_rescale: bool = True,
18
+ rescale_factor: float = 1 / 255.0,
19
+ image_mean=0.421,
20
+ image_std=0.165,
21
+ do_normalize: bool = True,
22
+ do_resize: bool = True,
23
+ size: dict[str, int] = {"height": 96, "width": 96},
24
+ do_center_crop: bool = True,
25
+ crop_size: dict[str, int] = {"height": 88, "width": 88},
26
+ **kwargs: Unpack[VideosKwargs],
27
+ ):
28
+ super().__init__(
29
+ do_rescale=do_rescale,
30
+ rescale_factor=rescale_factor,
31
+ image_mean=image_mean,
32
+ image_std=image_std,
33
+ do_normalize=do_normalize,
34
+ do_resize=do_resize,
35
+ size=size,
36
+ do_center_crop=do_center_crop,
37
+ crop_size=crop_size,
38
+ **kwargs,
39
+ )
40
+ self.do_convert_rgb_to_grayscale = do_convert_rgb_to_grayscale
41
+
42
+ def sample_frames(
43
+ self,
44
+ metadata: VideoMetadata,
45
+ num_frames: int | None = None,
46
+ fps: int | float | None = None,
47
+ **kwargs,
48
+ ):
49
+ if num_frames:
50
+ total_frames = metadata.total_num_frames
51
+ num_frames = num_frames if num_frames is not None else self.num_frames
52
+ assert num_frames is not None, (
53
+ "`num_frames` must be specified if `fixed_len_video == True`"
54
+ )
55
+ frame_idxs = [
56
+ int(i * (total_frames - 1) / (num_frames - 1))
57
+ for i in range(num_frames)
58
+ ]
59
+ return torch.tensor(frame_idxs)
60
+ else:
61
+ return super().sample_frames(metadata, num_frames, fps, **kwargs)
62
+
63
+ def _load_video(self, src: str | bytes) -> torch.Tensor:
64
+ """
65
+ Load video from a file path or bytes and return as a 4D torch.Tensor.
66
+ Args:
67
+ src (str | bytes): Path to the video file or bytes of the video file.
68
+ Returns:
69
+ torch.Tensor: Loaded video as a 4D tensor (num_frames, height, width, num_channels).
70
+ """
71
+ vd = VideoDecoder(src)
72
+ video = vd.get_frames_in_range(0, vd.metadata.num_frames).data
73
+ return video
74
+
75
+ def __call__(
76
+ self, videos: VideoInput | str | list[str] | bytes | list[bytes], **kwargs
77
+ ):
78
+ """Overrides the __call__ method to handle video input as file paths or bytes."""
79
+ if isinstance(videos, (str, bytes)):
80
+ videos = self._load_video(videos)
81
+ elif isinstance(videos, list) and isinstance(videos[0], (str, bytes)):
82
+ videos = [self._load_video(v) for v in videos]
83
+
84
+ # remove kwargs not in VideosKwargs
85
+ # for key in list(kwargs.keys()):
86
+ # if key not in VideosKwargs.__optional_keys__:
87
+ # kwargs.pop(key, None)
88
+ return super().__call__(videos, **kwargs)
89
+
90
+ def convert_rgb_to_grayscale(self, video: torch.Tensor) -> torch.Tensor:
91
+ """
92
+ Convert a video to grayscale.
93
+ """
94
+ video = tvF.rgb_to_grayscale(video)
95
+ return video
96
+
97
+ def _preprocess(
98
+ self,
99
+ videos: VideoInput,
100
+ **kwargs: Unpack[VideosKwargs],
101
+ ) -> BatchFeature:
102
+ """
103
+ Preprocesses a video or a batch of videos.
104
+ Args:
105
+ videos (VideoInput): Video to preprocess.
106
+ See `VideoInput` for details.
107
+ **kwargs: Additional keyword arguments.
108
+ Returns:
109
+ BatchFeature: A BatchFeature with the following fields:
110
+ - pixel_values_videos: Pixel values to be fed to a model, of shape (batch_size,num_channels, num_frames, height, width).
111
+ - padding_mask_videos (optional): Mask to be used for padding, of shape (batch_size, num_frames).
112
+ """
113
+
114
+ # Always set `return_tensors` to `None` since it won't pad variable length videos
115
+ # We'll handle this after we call the parent' method
116
+ return_tensors = kwargs.pop("return_tensors", None)
117
+ result = super()._preprocess(videos, **kwargs)
118
+ pixels = result.pixel_values_videos
119
+ if self.do_convert_rgb_to_grayscale:
120
+ pixels = [self.convert_rgb_to_grayscale(video) for video in pixels]
121
+ data = {"pixel_values_videos": pixels}
122
+ if return_tensors:
123
+ lengths = torch.tensor([video.size(0) for video in pixels])
124
+ pixels = torch.nn.utils.rnn.pad_sequence(
125
+ pixels, batch_first=True, padding_value=0.0
126
+ )
127
+ data["pixel_values_videos"] = pixels
128
+ if lengths.unique().size(0) > 1:
129
+ mask = torch.arange(lengths.max())[None] < lengths[:, None]
130
+ data["padding_mask_videos"] = mask
131
+ # pixel_values_videos shape [batch_size, num_channels, num_frames, height, width]
132
+ data["pixel_values_videos"] = data["pixel_values_videos"].permute(0, 2, 1, 3, 4)
133
+
134
+ return BatchFeature(data=data, tensor_type=return_tensors)
vocab.json ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "'": 26,
3
+ "</s>": 2,
4
+ "<pad>": 0,
5
+ "<s>": 1,
6
+ "<unk>": 3,
7
+ "A": 8,
8
+ "B": 24,
9
+ "C": 20,
10
+ "D": 15,
11
+ "E": 5,
12
+ "F": 22,
13
+ "G": 21,
14
+ "H": 11,
15
+ "I": 9,
16
+ "J": 28,
17
+ "K": 25,
18
+ "L": 14,
19
+ "M": 19,
20
+ "N": 10,
21
+ "O": 7,
22
+ "P": 23,
23
+ "Q": 30,
24
+ "R": 13,
25
+ "S": 12,
26
+ "T": 6,
27
+ "U": 16,
28
+ "V": 27,
29
+ "W": 18,
30
+ "X": 29,
31
+ "Y": 17,
32
+ "Z": 31,
33
+ "|": 4
34
+ }