fschwartzer commited on
Commit
b1463e8
·
verified ·
1 Parent(s): 07fef94

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -3
app.py CHANGED
@@ -1,10 +1,19 @@
1
  import pandas as pd
2
  import gradio as gr
3
- from transformers import AutoTokenizer, AutoModelForCausalLM
4
 
5
- # Load the model and tokenizer for Meta LLaMA 3.1
 
 
 
 
 
 
 
 
 
6
  tokenizer = AutoTokenizer.from_pretrained("meta-llama/Meta-Llama-3.1-8B")
7
- model = AutoModelForCausalLM.from_pretrained("meta-llama/Meta-Llama-3.1-8B")
8
 
9
  # Load and preprocess the DataFrame
10
  df = pd.read_csv('anomalies.csv')
 
1
  import pandas as pd
2
  import gradio as gr
3
+ from transformers import AutoTokenizer, AutoModelForCausalLM, AutoConfig
4
 
5
+ # Load the configuration and adjust it
6
+ config = AutoConfig.from_pretrained("meta-llama/Meta-Llama-3.1-8B")
7
+ if 'rope_scaling' in config.to_dict() and isinstance(config.rope_scaling, dict):
8
+ # Adjust the rope_scaling to match the expected format
9
+ config.rope_scaling = {
10
+ "type": config.rope_scaling.get('rope_type', 'llama3'),
11
+ "factor": config.rope_scaling.get('factor', 8.0)
12
+ }
13
+
14
+ # Load the tokenizer and model with the adjusted configuration
15
  tokenizer = AutoTokenizer.from_pretrained("meta-llama/Meta-Llama-3.1-8B")
16
+ model = AutoModelForCausalLM.from_config(config)
17
 
18
  # Load and preprocess the DataFrame
19
  df = pd.read_csv('anomalies.csv')