Skip to content

Commit

Permalink
fix copies and style
Browse files Browse the repository at this point in the history
  • Loading branch information
ArthurZucker committed Jan 13, 2025
1 parent e2d4d3a commit 703ff88
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
22 changes: 17 additions & 5 deletions src/transformers/convert_slow_tokenizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1487,7 +1487,7 @@ def tokenizer(self, proto):
]
)
tokenizer.add_tokens([AddedToken("\n", normalized=False, special=False)])
tokenizer.enable_padding(pad_token ="<pad>", pad_id=3)
tokenizer.enable_padding(pad_token="<pad>", pad_id=3)
return tokenizer

def vocab(self, proto):
Expand All @@ -1513,15 +1513,27 @@ def decoder(self, replacement, add_prefix_space):
return decoders.Sequence(sequence)

def normalizer(self, proto):
return normalizers.Sequence([normalizers.Prepend(" "), normalizers.Replace(r" ","▁")]) #, normalizers.Replace("\n", "<0x0A>" )])
return normalizers.Sequence(
[normalizers.Prepend(" "), normalizers.Replace(r" ", "▁")]
) # , normalizers.Replace("\n", "<0x0A>" )])

def pre_tokenizer(self, replacement, add_prefix_space):
return pre_tokenizers.Sequence([pre_tokenizers.Split('\n', "contiguous")]) #(prepend_scheme="always", split=True)])
return pre_tokenizers.Sequence(
[pre_tokenizers.Split("\n", "contiguous")]
) # (prepend_scheme="always", split=True)])

def post_processor(self):
return processors.TemplateProcessing(
single=["<s>", "$A",],
pair=[ "<s>", "$A", "<s>", "$B",],
single=[
"<s>",
"$A",
],
pair=[
"<s>",
"$A",
"<s>",
"$B",
],
special_tokens=[
("<s>", 1),
],
Expand Down
1 change: 0 additions & 1 deletion src/transformers/models/helium/configuration_helium.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,3 @@ def __init__(


__all__ = ["HeliumConfig"]

6 changes: 1 addition & 5 deletions src/transformers/models/helium/modular_helium.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,12 @@
)
from ..granite.modeling_granite import (
GraniteAttention,
GraniteFlashAttention2,
GraniteSdpaAttention,
)
from ..llama.modeling_llama import (
LlamaDecoderLayer,
LlamaMLP,
LlamaModel,
LlamaPreTrainedModel,
LlamaMLP,
LlamaRMSNorm,
LlamaRotaryEmbedding,
)
from .configuration_helium import HeliumConfig
Expand Down Expand Up @@ -172,4 +169,3 @@ def __init__(self, config: HeliumConfig):
"HeliumForSequenceClassification",
"HeliumForTokenClassification",
]

0 comments on commit 703ff88

Please sign in to comment.