Zwounds commited on
Commit
e2c5a01
·
verified ·
1 Parent(s): 74654a8

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. demo.py +9 -3
  2. requirements.txt +1 -1
demo.py CHANGED
@@ -1,6 +1,6 @@
1
  import gradio as gr
2
  import torch
3
- from transformers import AutoModelForCausalLM, AutoTokenizer
4
  import logging
5
 
6
  # Setup logging
@@ -10,13 +10,19 @@ logger = logging.getLogger(__name__)
10
  def load_model():
11
  """Load fine-tuned model without quantization for CPU compatibility."""
12
  logger.info("Loading model...")
13
- tokenizer = AutoTokenizer.from_pretrained("Zwounds/boolean-search-model")
 
 
 
 
 
14
 
15
  # Load model in the most compatible way for Spaces
16
  model = AutoModelForCausalLM.from_pretrained(
17
  "Zwounds/boolean-search-model",
18
  low_cpu_mem_usage=True,
19
- torch_dtype=torch.float32 # Use standard floating point for CPU
 
20
  )
21
  return model, tokenizer
22
 
 
1
  import gradio as gr
2
  import torch
3
+ from transformers import AutoModelForCausalLM, LlamaTokenizer
4
  import logging
5
 
6
  # Setup logging
 
10
  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
 
requirements.txt CHANGED
@@ -1,3 +1,3 @@
1
  torch==2.0.1
2
- transformers==4.31.0
3
  gradio>=4.0.0
 
1
  torch==2.0.1
2
+ transformers==4.37.2
3
  gradio>=4.0.0