kas1 commited on
Commit
02009c3
·
1 Parent(s): 23afbfb

Remove quantization_config entirely to avoid bitsandbytes dependency3

Browse files
Files changed (2) hide show
  1. app.py +7 -32
  2. requirements.txt +1 -2
app.py CHANGED
@@ -1,38 +1,13 @@
1
  import gradio as gr
2
- from transformers import AutoModelForCausalLM, AutoTokenizer, AutoConfig
3
- import accelerate
4
 
5
- print("Accelerate version:", accelerate.__version__)
 
 
6
 
7
- # Load the original model with overridden configuration
8
- original_config = AutoConfig.from_pretrained(
9
- "unsloth/DeepSeek-R1-Distill-Llama-8B-unsloth-bnb-4bit"
10
- )
11
- # Remove quantization-related attributes from the config
12
- original_config._load_in_4bit = False
13
- original_config._load_in_8bit = False
14
- original_config.quant_method = None
15
-
16
- original_model = AutoModelForCausalLM.from_pretrained(
17
- "unsloth/DeepSeek-R1-Distill-Llama-8B-unsloth-bnb-4bit",
18
- config=original_config # Use the overridden configuration
19
- )
20
- original_tokenizer = AutoTokenizer.from_pretrained("unsloth/DeepSeek-R1-Distill-Llama-8B-unsloth-bnb-4bit")
21
-
22
- # Load the fine-tuned model with overridden configuration
23
- fine_tuned_config = AutoConfig.from_pretrained(
24
- "kas1/DeepSeek-R1-Distill-Llama-8B-unsloth-bnb-4bit-John1"
25
- )
26
- # Remove quantization-related attributes from the config
27
- fine_tuned_config._load_in_4bit = False
28
- fine_tuned_config._load_in_8bit = False
29
- fine_tuned_config.quant_method = None
30
-
31
- fine_tuned_model = AutoModelForCausalLM.from_pretrained(
32
- "kas1/DeepSeek-R1-Distill-Llama-8B-unsloth-bnb-4bit-John1",
33
- config=fine_tuned_config # Use the overridden configuration
34
- )
35
- fine_tuned_tokenizer = AutoTokenizer.from_pretrained("kas1/DeepSeek-R1-Distill-Llama-8B-unsloth-bnb-4bit-John1")
36
 
37
  # Function to generate responses from both models
38
  def compare_models(prompt):
 
1
  import gradio as gr
2
+ from transformers import AutoModelForCausalLM, AutoTokenizer
 
3
 
4
+ # Load the original model
5
+ original_model = AutoModelForCausalLM.from_pretrained("unsloth/DeepSeek-R1-Distill-Llama-8B")
6
+ original_tokenizer = AutoTokenizer.from_pretrained("unsloth/DeepSeek-R1-Distill-Llama-8B")
7
 
8
+ # Load the fine-tuned model
9
+ fine_tuned_model = AutoModelForCausalLM.from_pretrained("kas1/DeepSeek-R1-Distill-Llama-8B-John1")
10
+ fine_tuned_tokenizer = AutoTokenizer.from_pretrained("kas1/DeepSeek-R1-Distill-Llama-8B-John1")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
 
12
  # Function to generate responses from both models
13
  def compare_models(prompt):
requirements.txt CHANGED
@@ -1,4 +1,3 @@
1
  torch
2
  transformers
3
- gradio
4
- accelerate>=0.26.0
 
1
  torch
2
  transformers
3
+ gradio