Futuresony commited on
Commit
21f236d
·
verified ·
1 Parent(s): 3aa8de0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -1
app.py CHANGED
@@ -10,10 +10,18 @@ def load_model_and_adapter():
10
  base_model_name = "unsloth/Llama-3.2-3B-Instruct" # Replace with your base model name
11
  adapter_repo = "Futuresony/future_ai_12_10_2024" # Your Hugging Face LoRA repo
12
 
13
- # Load tokenizer and base model
14
  tokenizer = AutoTokenizer.from_pretrained(base_model_name)
 
 
 
 
 
 
 
15
  base_model = AutoModelForCausalLM.from_pretrained(
16
  base_model_name,
 
17
  torch_dtype=torch.float16, # Use float16 for efficiency if GPU is available
18
  device_map="auto" # Automatically map to GPU or CPU
19
  )
 
10
  base_model_name = "unsloth/Llama-3.2-3B-Instruct" # Replace with your base model name
11
  adapter_repo = "Futuresony/future_ai_12_10_2024" # Your Hugging Face LoRA repo
12
 
13
+ # Load tokenizer
14
  tokenizer = AutoTokenizer.from_pretrained(base_model_name)
15
+
16
+ # Fix rope_scaling in model configuration
17
+ config = AutoModelForCausalLM.config_class.from_pretrained(base_model_name)
18
+ if hasattr(config, "rope_scaling"):
19
+ config.rope_scaling = {"type": "dynamic", "factor": 32.0} # Override with valid keys
20
+
21
+ # Load base model with fixed config
22
  base_model = AutoModelForCausalLM.from_pretrained(
23
  base_model_name,
24
+ config=config,
25
  torch_dtype=torch.float16, # Use float16 for efficiency if GPU is available
26
  device_map="auto" # Automatically map to GPU or CPU
27
  )