christopher-hoernle
commited on
Commit
·
8425c4b
1
Parent(s):
51ea6ce
fixes #2
Browse files
model.py
CHANGED
@@ -1,11 +1,6 @@
|
|
1 |
from transformers.models.whisper.configuration_whisper import WhisperConfig
|
2 |
-
|
3 |
-
from transformers.generation.logits_process import (
|
4 |
-
LogitsProcessorList,
|
5 |
-
SuppressTokensLogitsProcessor
|
6 |
-
)
|
7 |
from typing import List, Optional, Dict, Any
|
8 |
-
import warnings
|
9 |
|
10 |
"""Custom config to support modification of the Whisper encoder."""
|
11 |
|
@@ -63,11 +58,18 @@ class CustomWhisperConfig(WhisperConfig):
|
|
63 |
import math
|
64 |
from typing import Optional, Tuple, Union
|
65 |
|
|
|
66 |
import numpy as np
|
67 |
import torch
|
68 |
import torch.utils.checkpoint
|
69 |
from torch import nn
|
70 |
from torch.nn import CrossEntropyLoss
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
|
72 |
from transformers.activations import ACT2FN
|
73 |
from transformers.cache_utils import Cache, DynamicCache, EncoderDecoderCache, StaticCache
|
|
|
1 |
from transformers.models.whisper.configuration_whisper import WhisperConfig
|
2 |
+
|
|
|
|
|
|
|
|
|
3 |
from typing import List, Optional, Dict, Any
|
|
|
4 |
|
5 |
"""Custom config to support modification of the Whisper encoder."""
|
6 |
|
|
|
58 |
import math
|
59 |
from typing import Optional, Tuple, Union
|
60 |
|
61 |
+
import warnings
|
62 |
import numpy as np
|
63 |
import torch
|
64 |
import torch.utils.checkpoint
|
65 |
from torch import nn
|
66 |
from torch.nn import CrossEntropyLoss
|
67 |
+
import torch.nn.functional as F
|
68 |
+
|
69 |
+
from transformers.generation.logits_process import (
|
70 |
+
LogitsProcessorList,
|
71 |
+
SuppressTokensLogitsProcessor
|
72 |
+
)
|
73 |
|
74 |
from transformers.activations import ACT2FN
|
75 |
from transformers.cache_utils import Cache, DynamicCache, EncoderDecoderCache, StaticCache
|