Initial upload of FreeChunk model with custom code
Browse files- modeling_freechunker.py +3 -2
modeling_freechunker.py
CHANGED
|
@@ -16,7 +16,7 @@
|
|
| 16 |
"""FreeChunker model: Modified from PyTorch XLM-RoBERTa model."""
|
| 17 |
from .utils import generate_shifted_matrix
|
| 18 |
import math
|
| 19 |
-
from typing import Optional, Tuple, Union, List
|
| 20 |
|
| 21 |
import torch
|
| 22 |
import torch.utils.checkpoint
|
|
@@ -653,7 +653,8 @@ class FreeChunkerModel(FreeChunkerPreTrainedModel):
|
|
| 653 |
input_ids: Optional[torch.Tensor] = None,
|
| 654 |
head_mask: Optional[torch.Tensor] = None,
|
| 655 |
encoder_hidden_states: Optional[torch.Tensor] = None,
|
| 656 |
-
encoder_attention_mask: Optional[torch.Tensor] = None
|
|
|
|
| 657 |
) -> Union[Tuple[torch.Tensor], BaseModelOutputWithPoolingAndCrossAttentions]:
|
| 658 |
|
| 659 |
# Get input device
|
|
|
|
| 16 |
"""FreeChunker model: Modified from PyTorch XLM-RoBERTa model."""
|
| 17 |
from .utils import generate_shifted_matrix
|
| 18 |
import math
|
| 19 |
+
from typing import List, Optional, Tuple, Union, List
|
| 20 |
|
| 21 |
import torch
|
| 22 |
import torch.utils.checkpoint
|
|
|
|
| 653 |
input_ids: Optional[torch.Tensor] = None,
|
| 654 |
head_mask: Optional[torch.Tensor] = None,
|
| 655 |
encoder_hidden_states: Optional[torch.Tensor] = None,
|
| 656 |
+
encoder_attention_mask: Optional[torch.Tensor] = None,
|
| 657 |
+
granularities: Optional[List[int]] = None,
|
| 658 |
) -> Union[Tuple[torch.Tensor], BaseModelOutputWithPoolingAndCrossAttentions]:
|
| 659 |
|
| 660 |
# Get input device
|