Upload 3 files
Browse files- README.md +17 -3
- config.json +97 -0
- prompt_templates.json +59 -0
README.md
CHANGED
@@ -1,3 +1,17 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Jaleah AI Coder Model
|
2 |
+
|
3 |
+
Custom AI code generation model for intelligent programming assistance.
|
4 |
+
|
5 |
+
## Usage
|
6 |
+
|
7 |
+
```python
|
8 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
9 |
+
|
10 |
+
model = AutoModelForCausalLM.from_pretrained('teckmill/Jaleah-AI')
|
11 |
+
tokenizer = AutoTokenizer.from_pretrained('teckmill/Jaleah-AI')
|
12 |
+
```
|
13 |
+
|
14 |
+
## Limitations
|
15 |
+
- Experimental model
|
16 |
+
- Requires careful review
|
17 |
+
- May generate incorrect code
|
config.json
ADDED
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"model_name": "ai-coder-v1",
|
3 |
+
"model_type": "llama",
|
4 |
+
"vocab_size": 10000,
|
5 |
+
"n_positions": 2048,
|
6 |
+
"n_ctx": 2048,
|
7 |
+
"n_embd": 512,
|
8 |
+
"n_layer": 6,
|
9 |
+
"n_head": 8,
|
10 |
+
"n_kv_head": 4,
|
11 |
+
"rotary_dim": 64,
|
12 |
+
"activation_function": "swiglu",
|
13 |
+
"layer_norm_epsilon": 1e-05,
|
14 |
+
"initializer_range": 0.02,
|
15 |
+
"use_cache": true,
|
16 |
+
"rope_scaling": {
|
17 |
+
"type": "dynamic",
|
18 |
+
"factor": 2.0
|
19 |
+
},
|
20 |
+
"sliding_window": 1024,
|
21 |
+
"attention_config": {
|
22 |
+
"type": "multi_query",
|
23 |
+
"head_dim": 64,
|
24 |
+
"kv_heads": 4,
|
25 |
+
"sliding_window": 1024,
|
26 |
+
"attention_dropout": 0.1
|
27 |
+
},
|
28 |
+
"architectures": [
|
29 |
+
"LlamaForCausalLM"
|
30 |
+
],
|
31 |
+
"tokenizer_class": "CodeTokenizer",
|
32 |
+
"tie_word_embeddings": true,
|
33 |
+
"torch_dtype": "bfloat16",
|
34 |
+
"transformers_version": "4.37.0",
|
35 |
+
"flash_attention": false,
|
36 |
+
"gradient_checkpointing": false,
|
37 |
+
"use_memory_efficient_attention": false,
|
38 |
+
"parallel_attention": false,
|
39 |
+
"learning_config": {
|
40 |
+
"online_learning": {
|
41 |
+
"enabled": false,
|
42 |
+
"learning_rate": 0.0001,
|
43 |
+
"batch_size": 16,
|
44 |
+
"max_steps": 100,
|
45 |
+
"warmup_steps": 10
|
46 |
+
},
|
47 |
+
"meta_learning": {
|
48 |
+
"enabled": false,
|
49 |
+
"inner_learning_rate": 0.001,
|
50 |
+
"outer_learning_rate": 0.0001,
|
51 |
+
"num_inner_steps": 3,
|
52 |
+
"num_outer_steps": 10
|
53 |
+
},
|
54 |
+
"active_learning": {
|
55 |
+
"enabled": true,
|
56 |
+
"uncertainty_threshold": 0.8,
|
57 |
+
"max_queries_per_session": 5,
|
58 |
+
"min_confidence_score": 0.6
|
59 |
+
},
|
60 |
+
"knowledge_distillation": {
|
61 |
+
"enabled": true,
|
62 |
+
"temperature": 2.0,
|
63 |
+
"alpha": 0.5,
|
64 |
+
"teacher_models": [
|
65 |
+
"gpt-4",
|
66 |
+
"claude-3"
|
67 |
+
]
|
68 |
+
},
|
69 |
+
"feedback_learning": {
|
70 |
+
"enabled": true,
|
71 |
+
"feedback_buffer_size": 1000,
|
72 |
+
"min_feedback_samples": 50,
|
73 |
+
"update_interval": 100
|
74 |
+
},
|
75 |
+
"optimization": {
|
76 |
+
"optimizer": "adamw",
|
77 |
+
"weight_decay": 0.01,
|
78 |
+
"learning_rate_scheduler": "cosine",
|
79 |
+
"warmup_ratio": 0.1,
|
80 |
+
"gradient_clip_val": 1.0
|
81 |
+
}
|
82 |
+
},
|
83 |
+
"advanced_features": {
|
84 |
+
"code_completion": true,
|
85 |
+
"type_inference": true,
|
86 |
+
"semantic_analysis": true,
|
87 |
+
"refactoring": true,
|
88 |
+
"bug_detection": true,
|
89 |
+
"security_analysis": true,
|
90 |
+
"performance_optimization": true,
|
91 |
+
"style_checking": true,
|
92 |
+
"documentation_generation": true,
|
93 |
+
"test_generation": true,
|
94 |
+
"multi_language_support": true,
|
95 |
+
"framework_detection": true
|
96 |
+
}
|
97 |
+
}
|
prompt_templates.json
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"code_generation": {
|
3 |
+
"template": "You are AI Coder, a specialized coding assistant. Generate {language} code for the following task:\n\nTask: {task_description}\n\nRequirements:\n{requirements}\n\nPlease provide clean, efficient, and well-documented code that follows best practices.\n\nCode:",
|
4 |
+
"examples": [
|
5 |
+
{
|
6 |
+
"task_description": "Create a function to sort a list using quicksort",
|
7 |
+
"language": "python",
|
8 |
+
"requirements": [
|
9 |
+
"Handle empty lists",
|
10 |
+
"Support custom comparison functions",
|
11 |
+
"Use type hints"
|
12 |
+
],
|
13 |
+
"output": "def quicksort(arr: list, key=lambda x: x) -> list:\n \"\"\"Sort a list using the quicksort algorithm.\n \n Args:\n arr: List to sort\n key: Function to get comparison key\n \n Returns:\n Sorted list\n \"\"\"\n if not arr:\n return []\n \n pivot = arr[len(arr) // 2]\n left = [x for x in arr if key(x) < key(pivot)]\n middle = [x for x in arr if key(x) == key(pivot)]\n right = [x for x in arr if key(x) > key(pivot)]\n \n return quicksort(left, key) + middle + quicksort(right, key)"
|
14 |
+
}
|
15 |
+
]
|
16 |
+
},
|
17 |
+
"code_analysis": {
|
18 |
+
"template": "Analyze the following code for potential issues and improvements:\n\nCode:\n{code}\n\nFocus on:\n- Code quality and readability\n- Performance optimizations\n- Security concerns\n- Best practices and patterns\n\nAnalysis:",
|
19 |
+
"examples": [
|
20 |
+
{
|
21 |
+
"code": "def process_data(data):\n result = []\n for i in range(len(data)):\n if data[i] > 0:\n result.append(data[i] * 2)",
|
22 |
+
"output": "Code Quality:\n- Use list comprehension for better readability\n- Add type hints\n- Add docstring\n\nPerformance:\n- Avoid using range(len()) with lists\n- Consider using list comprehension for better performance\n\nBest Practices:\n- Add return statement\n- Add error handling for invalid inputs"
|
23 |
+
}
|
24 |
+
]
|
25 |
+
},
|
26 |
+
"code_refactor": {
|
27 |
+
"template": "Refactor the following code to improve its quality:\n\nOriginal Code:\n{code}\n\nFocus Areas:\n{focus_areas}\n\nProvide the refactored code and explain the improvements made.\n\nRefactored Code:",
|
28 |
+
"examples": [
|
29 |
+
{
|
30 |
+
"code": "def calc(x,y,op):\n if op=='add':\n return x+y\n if op=='sub':\n return x-y\n if op=='mul':\n return x*y\n if op=='div':\n return x/y",
|
31 |
+
"focus_areas": [
|
32 |
+
"Code structure",
|
33 |
+
"Error handling",
|
34 |
+
"Documentation"
|
35 |
+
],
|
36 |
+
"output": "from typing import Union\n\ndef calculate(x: Union[int, float], y: Union[int, float], operation: str) -> Union[int, float]:\n \"\"\"Perform basic arithmetic operations.\n \n Args:\n x: First number\n y: Second number\n operation: Operation to perform ('add', 'sub', 'mul', 'div')\n \n Returns:\n Result of the operation\n \n Raises:\n ValueError: If operation is invalid\n ZeroDivisionError: If dividing by zero\n \"\"\"\n operations = {\n 'add': lambda a, b: a + b,\n 'sub': lambda a, b: a - b,\n 'mul': lambda a, b: a * b,\n 'div': lambda a, b: a / b if b != 0 else raise ZeroDivisionError('Cannot divide by zero')\n }\n \n if operation not in operations:\n raise ValueError(f'Invalid operation. Must be one of: {list(operations.keys())}')\n \n return operations[operation](x, y)"
|
37 |
+
}
|
38 |
+
]
|
39 |
+
},
|
40 |
+
"error_handling": {
|
41 |
+
"template": "The following code has an error:\n\nCode:\n{code}\n\nError:\n{error}\n\nProvide a detailed explanation of the error and how to fix it:",
|
42 |
+
"examples": [
|
43 |
+
{
|
44 |
+
"code": "def get_value(dict, key):\n return dict[key]",
|
45 |
+
"error": "KeyError: 'name'",
|
46 |
+
"output": "The error occurs because the key 'name' doesn't exist in the dictionary. To fix this:\n\n1. Use dict.get() method with a default value\n2. Add error handling with try-except\n3. Check if key exists before accessing\n\nHere's the fixed code:\n\ndef get_value(data: dict, key: str, default=None):\n return data.get(key, default)"
|
47 |
+
}
|
48 |
+
]
|
49 |
+
},
|
50 |
+
"documentation": {
|
51 |
+
"template": "Generate documentation for the following code:\n\nCode:\n{code}\n\nInclude:\n- Function/class purpose\n- Parameters\n- Return values\n- Examples\n- Notes/warnings\n\nDocumentation:",
|
52 |
+
"examples": [
|
53 |
+
{
|
54 |
+
"code": "def retry(func, max_attempts=3, delay=1):\n for attempt in range(max_attempts):\n try:\n return func()\n except Exception as e:\n if attempt == max_attempts - 1:\n raise\n time.sleep(delay)",
|
55 |
+
"output": "```python\ndef retry(func: Callable, max_attempts: int = 3, delay: float = 1) -> Any:\n \"\"\"Retry a function multiple times before giving up.\n \n Args:\n func: Function to retry\n max_attempts: Maximum number of attempts (default: 3)\n delay: Delay between attempts in seconds (default: 1)\n \n Returns:\n Result of the function if successful\n \n Raises:\n Exception: If all attempts fail, raises the last exception\n \n Example:\n >>> def unstable_api():\n ... if random.random() < 0.5:\n ... raise ConnectionError()\n ... return 'success'\n ...\n >>> result = retry(unstable_api, max_attempts=5, delay=0.1)\n \n Note:\n The function will sleep between attempts, so it may take\n (max_attempts - 1) * delay seconds to complete in the worst case.\n \"\"\"\n```"
|
56 |
+
}
|
57 |
+
]
|
58 |
+
}
|
59 |
+
}
|