Spaces:
Runtime error
Runtime error
Update pattern_analyzer.py
Browse files- pattern_analyzer.py +7 -1
pattern_analyzer.py
CHANGED
|
@@ -8,8 +8,14 @@ from pattern_logic import PatternLogic
|
|
| 8 |
|
| 9 |
class PatternAnalyzer:
|
| 10 |
def __init__(self):
|
| 11 |
-
self.model = AutoModelForCausalLM.from_pretrained(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
self.tokenizer = AutoTokenizer.from_pretrained("tmmdev/codellama-pattern-analysis")
|
|
|
|
| 13 |
self.basic_patterns = {
|
| 14 |
'channel': {'min_points': 4, 'confidence_threshold': 0.7},
|
| 15 |
'triangle': {'min_points': 3, 'confidence_threshold': 0.75},
|
|
|
|
| 8 |
|
| 9 |
class PatternAnalyzer:
|
| 10 |
def __init__(self):
|
| 11 |
+
self.model = AutoModelForCausalLM.from_pretrained(
|
| 12 |
+
"tmmdev/codellama-pattern-analysis",
|
| 13 |
+
load_in_8bit=True, # Enable 8-bit quantization
|
| 14 |
+
device_map="auto", # Optimize device usage
|
| 15 |
+
torch_dtype="auto" # Automatic precision selection
|
| 16 |
+
)
|
| 17 |
self.tokenizer = AutoTokenizer.from_pretrained("tmmdev/codellama-pattern-analysis")
|
| 18 |
+
|
| 19 |
self.basic_patterns = {
|
| 20 |
'channel': {'min_points': 4, 'confidence_threshold': 0.7},
|
| 21 |
'triangle': {'min_points': 3, 'confidence_threshold': 0.75},
|