File size: 3,299 Bytes
5fffedf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
"""

Configuration file for the Generative AI Programming Education project

"""

import os
from pathlib import Path

# Model Configuration
MODEL_CONFIG = {
    # Path to your fine-tuned CodeLlama-7B model
    "model_path": "./model",  # For Hugging Face Spaces deployment

    # Model generation parameters
    "max_new_tokens": 512,
    "temperature": 0.7,
    "do_sample": True,
    "top_p": 0.9,
    "top_k": 50,

    # Input processing
    "max_input_length": 2048,
    "truncation": True,

    # Device configuration
    "device_map": "auto",
    "torch_dtype": "float16",
    "trust_remote_code": True
}

# Dataset Configuration (for reference)
DATASET_CONFIG = {
    "code_review_dataset": "path/to/your/code_review_dataset",
    "code_feedback_dataset": "path/to/your/code_feedback_dataset",
    "training_data_format": "json",  # or "csv", "txt"
}

# Educational Levels
STUDENT_LEVELS = {
    "beginner": {
        "description": "Students new to programming",
        "feedback_style": "explanatory",
        "include_basics": True,
        "complexity_threshold": "low"
    },
    "intermediate": {
        "description": "Students with basic programming knowledge",
        "feedback_style": "balanced",
        "include_basics": False,
        "complexity_threshold": "medium"
    },
    "advanced": {
        "description": "Students with strong programming background",
        "feedback_style": "technical",
        "include_basics": False,
        "complexity_threshold": "high"
    }
}

# Feedback Types
FEEDBACK_TYPES = [
    "syntax",
    "logic",
    "optimization",
    "style",
    "explanation",
    "comprehensive_review",
    "educational_guidance"
]

# Learning Objectives
LEARNING_OBJECTIVES = [
    "syntax",
    "basic_python",
    "control_flow",
    "loops",
    "variables",
    "code_cleanliness",
    "algorithms",
    "complexity",
    "optimization",
    "naming_conventions",
    "readability",
    "code_analysis",
    "best_practices",
    "learning",
    "improvement"
]

# Logging Configuration
LOGGING_CONFIG = {
    "level": "INFO",
    "format": "%(asctime)s - %(name)s - %(levelname)s - %(message)s",
    "file": "programming_education_ai.log"
}

# Ethical Safeguards
ETHICAL_CONFIG = {
    "prevent_over_reliance": True,
    "encourage_learning": True,
    "provide_explanations": True,
    "suggest_alternatives": True,
    "promote_best_practices": True
}


def get_model_path():
    """Get the model path from environment variable or config"""
    return os.getenv("FINETUNED_MODEL_PATH", MODEL_CONFIG["model_path"])


def validate_config():
    """Validate the configuration settings"""
    model_path = get_model_path()
    if not os.path.exists(model_path):
        print(f"Warning: Model path does not exist: {model_path}")
        print("Please update the model_path in config.py or set FINETUNED_MODEL_PATH environment variable")
        return False
    return True


if __name__ == "__main__":
    print("Configuration loaded successfully!")
    print(f"Model path: {get_model_path()}")
    print(f"Student levels: {list(STUDENT_LEVELS.keys())}")
    print(f"Feedback types: {FEEDBACK_TYPES}")
    validate_config()