nouamanetazi HF staff commited on
Commit
59752f1
·
1 Parent(s): 165028c
Files changed (1) hide show
  1. utils.py +2 -5
utils.py CHANGED
@@ -1,6 +1,6 @@
1
  from transformers import AutoTokenizer
2
  import logging
3
- from transformers import GemmaTokenizer # Import GemmaTokenizer
4
 
5
  # Configure logging
6
  logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s')
@@ -8,10 +8,7 @@ logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %
8
  def get_tokenizer(id):
9
  logging.debug(f"Loading tokenizer: {id}")
10
  try:
11
- if "gemma" in id.lower():
12
- tokenizer = GemmaTokenizer.from_pretrained(id)
13
- else:
14
- tokenizer = AutoTokenizer.from_pretrained(id, trust_remote_code=True)
15
  logging.debug(f"Tokenizer loaded: {tokenizer}")
16
  return tokenizer
17
  except Exception as e:
 
1
  from transformers import AutoTokenizer
2
  import logging
3
+ import os
4
 
5
  # Configure logging
6
  logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s')
 
8
  def get_tokenizer(id):
9
  logging.debug(f"Loading tokenizer: {id}")
10
  try:
11
+ tokenizer = AutoTokenizer.from_pretrained(id, trust_remote_code=True, token=os.getenv("HF_TOKEN"))
 
 
 
12
  logging.debug(f"Tokenizer loaded: {tokenizer}")
13
  return tokenizer
14
  except Exception as e: