Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
tokenizer = AutoTokenizer.from_pretrained("meta-llama/Meta-Llama-3.1-8B")
|
| 7 |
-
model = AutoModelForCausalLM.
|
| 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')
|