first commit
This commit is contained in:
@@ -0,0 +1,123 @@
|
||||
const { TrainingData, ModelVersion } = require('../models');
|
||||
|
||||
module.exports = {
|
||||
up: async (queryInterface, Sequelize) => {
|
||||
try {
|
||||
// Create sample model versions
|
||||
const model1Version = await ModelVersion.create({
|
||||
model_name: 'MODEL1-v1.0',
|
||||
version: 'v1.0',
|
||||
model_type: 'MODEL1',
|
||||
base_model: 'moonshotai/kimi-k2-instruct-0905',
|
||||
fine_tuning_method: 'SFT',
|
||||
training_data_count: 0,
|
||||
performance_metrics: {
|
||||
accuracy: 0.85,
|
||||
precision: 0.82,
|
||||
recall: 0.88,
|
||||
f1_score: 0.85
|
||||
},
|
||||
is_active: true,
|
||||
deployment_status: 'deployed',
|
||||
hyperparameters: {
|
||||
learning_rate: 0.0001,
|
||||
batch_size: 16,
|
||||
epochs: 10,
|
||||
temperature: 0.3
|
||||
},
|
||||
training_log: {
|
||||
start_time: new Date(),
|
||||
end_time: new Date(),
|
||||
total_epochs: 10,
|
||||
final_loss: 0.15
|
||||
}
|
||||
});
|
||||
|
||||
const queryModelVersion = await ModelVersion.create({
|
||||
model_name: 'QUERYMODEL-v1.0',
|
||||
version: 'v1.0',
|
||||
model_type: 'QUERYMODEL',
|
||||
base_model: 'moonshotai/kimi-k2-instruct-0905',
|
||||
fine_tuning_method: 'SFT',
|
||||
training_data_count: 0,
|
||||
performance_metrics: {
|
||||
accuracy: 0.88,
|
||||
precision: 0.85,
|
||||
recall: 0.90,
|
||||
f1_score: 0.87
|
||||
},
|
||||
is_active: true,
|
||||
deployment_status: 'deployed',
|
||||
hyperparameters: {
|
||||
learning_rate: 0.0001,
|
||||
batch_size: 16,
|
||||
epochs: 10,
|
||||
temperature: 0.5
|
||||
},
|
||||
training_log: {
|
||||
start_time: new Date(),
|
||||
end_time: new Date(),
|
||||
total_epochs: 10,
|
||||
final_loss: 0.12
|
||||
}
|
||||
});
|
||||
|
||||
// Create sample training data
|
||||
const sampleTrainingData = [
|
||||
{
|
||||
model_version_id: model1Version.id,
|
||||
data_type: 'qa_pair',
|
||||
input_text: 'How do I design a bridge for heavy traffic loads?',
|
||||
output_text: 'To design a bridge for heavy traffic loads, follow these steps: 1. Calculate the maximum load requirements based on traffic volume and vehicle types. 2. Determine the bridge span and select appropriate structural system (beam, arch, or suspension). 3. Design the superstructure with adequate load capacity and safety factors. 4. Design the substructure including piers and foundations. 5. Consider environmental factors like wind, seismic loads, and temperature variations. 6. Perform structural analysis and design checks according to relevant codes (AASHTO, ACI, etc.). 7. Ensure adequate clearance and geometric requirements. 8. Plan for maintenance and inspection access.',
|
||||
context: { domain: 'civil_engineering', complexity: 'high' },
|
||||
quality_score: 0.95,
|
||||
is_validated: true,
|
||||
source: 'expert'
|
||||
},
|
||||
{
|
||||
model_version_id: model1Version.id,
|
||||
data_type: 'qa_pair',
|
||||
input_text: 'What are the key considerations for electrical system design in a commercial building?',
|
||||
output_text: 'Key considerations for electrical system design in commercial buildings include: 1. Load calculation and demand analysis. 2. Power distribution system design (main panels, subpanels, feeders). 3. Lighting design and control systems. 4. Emergency and backup power systems. 5. Grounding and bonding systems. 6. Electrical room and equipment space planning. 7. Code compliance (NEC, local codes). 8. Energy efficiency and sustainability. 9. Fire safety and protection systems. 10. Coordination with other building systems.',
|
||||
context: { domain: 'electrical_engineering', complexity: 'medium' },
|
||||
quality_score: 0.92,
|
||||
is_validated: true,
|
||||
source: 'expert'
|
||||
},
|
||||
{
|
||||
model_version_id: queryModelVersion.id,
|
||||
data_type: 'plan_pair',
|
||||
input_text: 'Execute a structural analysis for a steel frame building',
|
||||
output_text: 'To execute structural analysis for a steel frame building: 1. Gather building plans and load information. 2. Model the structure in analysis software (ETABS, SAP2000, or similar). 3. Apply dead loads, live loads, and environmental loads. 4. Run linear static analysis. 5. Check member stresses against allowable limits. 6. Verify deflection limits are met. 7. Perform stability analysis for lateral loads. 8. Generate analysis reports and drawings. 9. Review results with design team. 10. Document findings and recommendations.',
|
||||
context: { domain: 'structural_engineering', complexity: 'high' },
|
||||
quality_score: 0.90,
|
||||
is_validated: true,
|
||||
source: 'expert'
|
||||
}
|
||||
];
|
||||
|
||||
for (const data of sampleTrainingData) {
|
||||
await TrainingData.create(data);
|
||||
}
|
||||
|
||||
console.log('✅ Sample training data created');
|
||||
console.log(` - MODEL1 version: ${model1Version.id}`);
|
||||
console.log(` - QUERYMODEL version: ${queryModelVersion.id}`);
|
||||
console.log(` - Training data entries: ${sampleTrainingData.length}`);
|
||||
} catch (error) {
|
||||
console.error('❌ Error creating sample training data:', error);
|
||||
throw error;
|
||||
}
|
||||
},
|
||||
|
||||
down: async (queryInterface, Sequelize) => {
|
||||
try {
|
||||
await TrainingData.destroy({ where: {} });
|
||||
await ModelVersion.destroy({ where: {} });
|
||||
console.log('✅ Sample training data removed');
|
||||
} catch (error) {
|
||||
console.error('❌ Error removing sample training data:', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user