Sahil Seemant commited on
Commit
402e3e2
·
1 Parent(s): 2634f8f

Fix TokenizersBackend error by using slow tokenizer and adding mistral-common

Browse files
Files changed (2) hide show
  1. chat_gui.py +7 -1
  2. requirements.txt +2 -1
chat_gui.py CHANGED
@@ -300,10 +300,16 @@ if st.session_state.messages and st.session_state.messages[-1]["role"] == "user"
300
  model_class = AutoModelForCausalLM
301
 
302
  # Use AutoTokenizer for all (even VLMs have tokenizers)
 
303
  processor_class = AutoTokenizer
304
 
305
  st.info(f"Loading {st.session_state.current_model} via Transformers...")
306
- tokenizer = processor_class.from_pretrained(conf["path"], token=hf_token, trust_remote_code=True)
 
 
 
 
 
307
  # Use 4-bit quantization if on low-memory cloud
308
  model = model_class.from_pretrained(
309
  conf["path"],
 
300
  model_class = AutoModelForCausalLM
301
 
302
  # Use AutoTokenizer for all (even VLMs have tokenizers)
303
+ # Setting use_fast=False to avoid "TokenizersBackend" errors on some environments
304
  processor_class = AutoTokenizer
305
 
306
  st.info(f"Loading {st.session_state.current_model} via Transformers...")
307
+ tokenizer = processor_class.from_pretrained(
308
+ conf["path"],
309
+ token=hf_token,
310
+ trust_remote_code=True,
311
+ use_fast=False
312
+ )
313
  # Use 4-bit quantization if on low-memory cloud
314
  model = model_class.from_pretrained(
315
  conf["path"],
requirements.txt CHANGED
@@ -11,7 +11,8 @@ altair==5.3.0
11
  # Inference (MLX for local Mac, Transformers for Cloud/Linux)
12
  mlx; platform_system == "Darwin"
13
  mlx-vlm; platform_system == "Darwin"
14
- transformers==4.48.2
 
15
  torch
16
  peft
17
  accelerate
 
11
  # Inference (MLX for local Mac, Transformers for Cloud/Linux)
12
  mlx; platform_system == "Darwin"
13
  mlx-vlm; platform_system == "Darwin"
14
+ transformers>=4.48.0
15
+ mistral-common>=1.8.6
16
  torch
17
  peft
18
  accelerate