curia007 commited on
Commit
653338f
·
verified ·
1 Parent(s): 28f066b

Upload Idaho Pick 3 Transformer checkpoint and artifacts

Browse files
Files changed (3) hide show
  1. model.safetensors +1 -1
  2. pick3_hf_model.py +12 -0
  3. tokenizer_config.json +1 -0
model.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:f8e811aa79b19b2fc477a7ec01be14b649381c87fbabe9a220392060d892bd71
3
  size 640720
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0f11176104e85f66ccd8b8481fff0308f7ec850d0fbd141ea22e8ddccb80ae77
3
  size 640720
pick3_hf_model.py CHANGED
@@ -474,6 +474,17 @@ model.eval()
474
  "transformers_version": config.transformers_version,
475
  }
476
 
 
 
 
 
 
 
 
 
 
 
 
477
  @classmethod
478
  def get_fast_tokenizer_dict(cls) -> Dict[str, Any]:
479
  """Returns the serialized Hugging Face Tokenizers fast tokenizer dictionary."""
@@ -558,6 +569,7 @@ model.eval()
558
  "unk_token": "[UNK]",
559
  "model_max_length": max_len,
560
  "clean_up_tokenization_spaces": False,
 
561
  "added_tokens_decoder": {
562
  "10": {"content": "<PAD>", "lstrip": False, "normalized": False, "rstrip": False, "single_word": False, "special": True},
563
  "11": {"content": "<BOS>", "lstrip": False, "normalized": False, "rstrip": False, "single_word": False, "special": True},
 
474
  "transformers_version": config.transformers_version,
475
  }
476
 
477
+ DEFAULT_CHAT_TEMPLATE: str = (
478
+ "{% for message in messages %}"
479
+ "{% if loop.first and messages[0]['role'] != 'system' %}{{ '<BOS>' }}{% endif %}"
480
+ "{% if message['role'] == 'system' %}{{ '<BOS>' + message['content'].strip() + ' ' }}"
481
+ "{% elif message['role'] == 'user' %}{% if not loop.first and messages[loop.index0 - 1]['role'] == 'assistant' %}{{ ' ' }}{% endif %}{{ message['content'].strip() + ' <PRED>' }}"
482
+ "{% elif message['role'] == 'assistant' %}{{ ' ' + message['content'].strip() + ' <EOS>' }}"
483
+ "{% endif %}"
484
+ "{% endfor %}"
485
+ "{% if add_generation_prompt and messages[-1]['role'] != 'assistant' %}{{ ' ' }}{% endif %}"
486
+ )
487
+
488
  @classmethod
489
  def get_fast_tokenizer_dict(cls) -> Dict[str, Any]:
490
  """Returns the serialized Hugging Face Tokenizers fast tokenizer dictionary."""
 
569
  "unk_token": "[UNK]",
570
  "model_max_length": max_len,
571
  "clean_up_tokenization_spaces": False,
572
+ "chat_template": cls.DEFAULT_CHAT_TEMPLATE,
573
  "added_tokens_decoder": {
574
  "10": {"content": "<PAD>", "lstrip": False, "normalized": False, "rstrip": False, "single_word": False, "special": True},
575
  "11": {"content": "<BOS>", "lstrip": False, "normalized": False, "rstrip": False, "single_word": False, "special": True},
tokenizer_config.json CHANGED
@@ -8,6 +8,7 @@
8
  "unk_token": "[UNK]",
9
  "model_max_length": 128,
10
  "clean_up_tokenization_spaces": false,
 
11
  "added_tokens_decoder": {
12
  "10": {
13
  "content": "<PAD>",
 
8
  "unk_token": "[UNK]",
9
  "model_max_length": 128,
10
  "clean_up_tokenization_spaces": false,
11
+ "chat_template": "{% for message in messages %}{% if loop.first and messages[0]['role'] != 'system' %}{{ '<BOS>' }}{% endif %}{% if message['role'] == 'system' %}{{ '<BOS>' + message['content'].strip() + ' ' }}{% elif message['role'] == 'user' %}{% if not loop.first and messages[loop.index0 - 1]['role'] == 'assistant' %}{{ ' ' }}{% endif %}{{ message['content'].strip() + ' <PRED>' }}{% elif message['role'] == 'assistant' %}{{ ' ' + message['content'].strip() + ' <EOS>' }}{% endif %}{% endfor %}{% if add_generation_prompt and messages[-1]['role'] != 'assistant' %}{{ ' ' }}{% endif %}",
12
  "added_tokens_decoder": {
13
  "10": {
14
  "content": "<PAD>",