Pmal commited on
Commit
fd165fd
·
verified ·
1 Parent(s): 337c24c

update1 app

Browse files
Files changed (1) hide show
  1. app.py +18 -7
app.py CHANGED
@@ -2,15 +2,26 @@ import gradio as gr
2
  from transformers import pipeline
3
 
4
  # Load the model and tokenizer
 
 
 
 
 
 
 
 
 
 
 
 
5
  def load_model():
6
- # Load the NuminaMath-72B-CoT model
7
- pipe = pipeline(
8
- "text-generation",
9
- model="AI-MO/NuminaMath-72B-CoT",
10
- torch_dtype="auto",
11
- device_map="auto" # Automatically map to available GPU/CPU
12
  )
13
- return pipe
14
 
15
  # Initialize the pipeline
16
  model_pipeline = load_model()
 
2
  from transformers import pipeline
3
 
4
  # Load the model and tokenizer
5
+ # def load_model():
6
+ # # Load the NuminaMath-72B-CoT model
7
+ # pipe = pipeline(
8
+ # "text-generation",
9
+ # model="AI-MO/NuminaMath-72B-CoT",
10
+ # torch_dtype="auto",
11
+ # device_map="auto" # Automatically map to available GPU/CPU
12
+ # )
13
+ # return pipe
14
+
15
+ from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
16
+
17
  def load_model():
18
+ tokenizer = AutoTokenizer.from_pretrained("AI-MO/NuminaMath-72B-CoT")
19
+ model = AutoModelForCausalLM.from_pretrained(
20
+ "AI-MO/NuminaMath-72B-CoT",
21
+ device_map="auto", # Automatically map to available GPU
22
+ offload_folder="offload" # Offload unused parts to disk
 
23
  )
24
+ return pipeline("text-generation", model=model, tokenizer=tokenizer)
25
 
26
  # Initialize the pipeline
27
  model_pipeline = load_model()