Zwounds commited on
Commit
e635ed4
·
verified ·
1 Parent(s): 6ed78e4

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. demo.py +5 -7
demo.py CHANGED
@@ -1,6 +1,6 @@
1
  import gradio as gr
2
  import torch
3
- from transformers import AutoModelForCausalLM, LlamaTokenizer
4
  import logging
5
 
6
  # Setup logging
@@ -11,18 +11,16 @@ def load_model():
11
  """Load fine-tuned model without quantization for CPU compatibility."""
12
  logger.info("Loading model...")
13
 
14
- # Use explicit LlamaTokenizer instead of AutoTokenizer
15
- tokenizer = LlamaTokenizer.from_pretrained(
16
- "Zwounds/boolean-search-model",
17
- trust_remote_code=True
18
  )
19
 
20
  # Load model in the most compatible way for Spaces
21
  model = AutoModelForCausalLM.from_pretrained(
22
  "Zwounds/boolean-search-model",
23
  low_cpu_mem_usage=True,
24
- torch_dtype=torch.float32, # Use standard floating point for CPU
25
- trust_remote_code=True
26
  )
27
  return model, tokenizer
28
 
 
1
  import gradio as gr
2
  import torch
3
+ from transformers import AutoModelForCausalLM, AutoTokenizer
4
  import logging
5
 
6
  # Setup logging
 
11
  """Load fine-tuned model without quantization for CPU compatibility."""
12
  logger.info("Loading model...")
13
 
14
+ # Use explicit AutoTokenizer instead of LlamaTokenizer
15
+ tokenizer = AutoTokenizer.from_pretrained(
16
+ "Zwounds/boolean-search-model"
 
17
  )
18
 
19
  # Load model in the most compatible way for Spaces
20
  model = AutoModelForCausalLM.from_pretrained(
21
  "Zwounds/boolean-search-model",
22
  low_cpu_mem_usage=True,
23
+ torch_dtype=torch.float32 # Use standard floating point for CPU
 
24
  )
25
  return model, tokenizer
26