Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
394 changes: 29 additions & 365 deletions Frontend/package-lock.json

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions Frontend/src/App.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
// src/App.jsx
import React, { useState, useEffect } from 'react';
import { BrowserRouter as Router, Routes, Route, useNavigate } from 'react-router-dom';
import { BrowserRouter as Router, Routes, Route } from 'react-router-dom';
import Navbar from './components/Navbar';
import LandingPage from './pages/AppLanding';
import DetectHardwarePage from './pages/DetectHardwarePage';
import FinetuneSettings from './pages/FinetuningSettingsPage';
import Loading from './pages/Loading';
import TechnicalDetailsPage from './pages/TechnicalDetailsPage';
import ListModels from './pages/ListModels';
import './index.css';
import ListAllModels from "./pages/ListAllModels";

Expand Down
4 changes: 0 additions & 4 deletions Frontend/src/components/Navbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,6 @@ const Navbar = ({ appName = "ModelForge" }) => {
);
};

// We're removing the footer since it's not in the screenshot
const renderFooter = () => {
return null;
};

return (
<>
Expand Down
72 changes: 26 additions & 46 deletions Frontend/src/pages/FinetuningSettingsPage.jsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React, { useState, useEffect } from 'react';
import { useNavigate } from 'react-router-dom';
import { config, getSystemInfo, uploadDataset, startTraining } from '../services/api';
import { config, getSystemInfo, validateDatasetPath, startTraining } from '../services/api';

const FinetuneSettings = ({ defaultValues, updateSettings }) => {
const navigate = useNavigate();
const [showAdvanced, setShowAdvanced] = useState(false);
const [selectedFile, setSelectedFile] = useState(null);
const [datasetPath, setDatasetPath] = useState('');
const [formState, setFormState] = useState({});
const [settingsUpdated, setSettingsUpdated] = useState(false);
const [activeTooltip, setActiveTooltip] = useState(null);
Expand Down Expand Up @@ -67,7 +67,6 @@ const FinetuneSettings = ({ defaultValues, updateSettings }) => {
};

console.log("Merged form state:", mergedState);
defaultValues = mergedState;
setFormState(mergedState);
} catch (err) {
console.error("Error fetching settings:", err);
Expand Down Expand Up @@ -95,9 +94,8 @@ const FinetuneSettings = ({ defaultValues, updateSettings }) => {
}
}, [defaultValues]);

const handleFileChange = (e) => {
const file = e.target.files[0];
setSelectedFile(file);
const handleDatasetPathChange = (e) => {
setDatasetPath(e.target.value);
};

const handleInputChange = (e) => {
Expand Down Expand Up @@ -144,16 +142,16 @@ const FinetuneSettings = ({ defaultValues, updateSettings }) => {
return;
}

// Step 1: Upload dataset if provided
if (selectedFile) {
console.log("Uploading dataset...");
const uploadResponse = await uploadDataset(selectedFile, formState);
console.log("Dataset uploaded:", uploadResponse);
// Update form state with the uploaded file path
formState.dataset = uploadResponse.file_path;
// Step 1: Validate dataset path
if (datasetPath.trim()) {
console.log("Validating dataset path...");
const validateResponse = await validateDatasetPath(datasetPath.trim());
console.log("Dataset validated:", validateResponse);

// Update form state with the validated file path
formState.dataset = validateResponse.file_path;
} else {
throw new Error("Please select a dataset file");
throw new Error("Please enter the path to your dataset file");
}

// Step 2: Prepare training configuration
Expand Down Expand Up @@ -240,7 +238,7 @@ const FinetuneSettings = ({ defaultValues, updateSettings }) => {
learning_rate: "How quickly the model adapts to new information",
per_device_train_batch_size: "How many examples are processed at once",
max_seq_length: "Maximum text length the model can handle",
dataset_file: "Your training examples in JSON format",
dataset_file: "Path to your local training data file (JSON or JSONL format)",
lora_r: "Controls model capacity and training speed",
lora_alpha: "Controls how much the model changes during training",
quantization: "Reduces model size to fit in memory",
Expand Down Expand Up @@ -496,39 +494,21 @@ const FinetuneSettings = ({ defaultValues, updateSettings }) => {

<div className="col-span-full">
<Tooltip id="dataset_file">
<label htmlFor="dataset_file" className="block text-sm font-medium text-gray-400 mb-1">
Dataset File
<label htmlFor="dataset_path" className="block text-sm font-medium text-gray-400 mb-1">
Dataset File Path
</label>
</Tooltip>
<div className="flex items-center">
<label className="w-full flex items-center justify-center px-4 py-2 border border-gray-700 rounded-lg cursor-pointer bg-gray-900 hover:bg-gray-800 transition">
<svg
xmlns="http://www.w3.org/2000/svg"
className="h-5 w-5 mr-2 text-gray-400"
fill="none"
viewBox="0 0 24 24"
stroke="currentColor"
>
<path
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth={2}
d="M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12"
/>
</svg>
<span className="text-white">Upload Dataset</span>
<input
type="file"
id="dataset_file"
name="dataset_file"
accept=".json,.jsonl"
className="hidden"
onChange={handleFileChange}
/>
</label>
</div>
<input
type="text"
id="dataset_path"
name="dataset_path"
placeholder="C:\path\to\your\dataset.json"
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The placeholder string uses Windows-style backslashes, but in JS string literals sequences like \t become escape sequences (tab, etc.), so the placeholder will render incorrectly. Escape the backslashes (e.g., C:\\path\\to\\...) or use a forward-slash example.

Suggested change
placeholder="C:\path\to\your\dataset.json"
placeholder="C:\\path\\to\\your\\dataset.json"

Copilot uses AI. Check for mistakes.
value={datasetPath}
onChange={handleDatasetPathChange}
className="bg-gray-900 border border-gray-700 rounded-lg p-3 w-full text-white focus:border-orange-500 focus:outline-none"
/>
<p className="mt-2 text-sm text-gray-400">
{selectedFile ? selectedFile.name : 'No file selected'}
Enter the full path to your local JSON or JSONL dataset file
</p>
</div>
</div>
Expand Down
1 change: 0 additions & 1 deletion Frontend/src/pages/ListModels.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from 'react';
import { useState, useEffect } from 'react';
import { Link, useLocation } from 'react-router-dom';

const ListModelsPage = () => {
const [models, setModels] = useState([]);
Expand Down
24 changes: 7 additions & 17 deletions Frontend/src/pages/Loading.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,6 @@ const Loading = () => {
"Starting training loop...",
"Training in progress..."
];

// Function to manually set idle status (for demo purposes)
const setTrainingComplete = () => {
setIsIdle(true);
setProgress(100);
setCurrentStep(steps.length - 1);
if (statusIntervalRef.current) {
clearInterval(statusIntervalRef.current);
}
};

// Function to check backend status
useEffect(() => {
Expand Down Expand Up @@ -112,19 +102,19 @@ const Loading = () => {
const modelPathResponse = await fetch(`${config.baseURL}/playground/model_path`, {
method: 'GET'
});

if (!modelPathResponse.ok) {
throw new Error('Failed to get model path');
}

// Extract the model path from the response
const modelPathData = await modelPathResponse.json();
const modelPath = modelPathData.model_path;

console.log("Received model path:", modelPath);

// Now send POST request with the model path
const response = await fetch(`${config.baseURL}/playground/new`, {
await fetch(`${config.baseURL}/playground/new`, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
Expand All @@ -133,10 +123,10 @@ const Loading = () => {
model_path: modelPath
})
});

// After successful POST request, redirect to homepage
navigate('/');

} catch (error) {
console.error('Error starting AI chat:', error);
// Show an error message to the user
Expand Down
1 change: 0 additions & 1 deletion Frontend/src/pages/TechnicalDetailsPage.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React, { useState } from 'react';
import { Link } from 'react-router-dom';

const TechnicalDetailsPage = () => {
const [activeTab, setActiveTab] = useState('architecture');
Expand Down
22 changes: 9 additions & 13 deletions Frontend/src/services/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,30 +30,26 @@ export const getSystemInfo = async () => {
};

/**
* Upload dataset file
* @param {File} file - Dataset file (JSON/JSONL)
* @param {Object} settings - Training settings
* @returns {Promise<Object>} Upload response
* Validate a local dataset file path
* @param {string} datasetPath - Local file path to the dataset
* @returns {Promise<Object>} Validation response with file_path
*/
export const uploadDataset = async (file, settings) => {
export const validateDatasetPath = async (datasetPath) => {
try {
const formData = new FormData();
formData.append('json_file', file, file.name);
formData.append('settings', JSON.stringify(settings));

const response = await fetch(`${config.baseURL}/finetune/load_settings`, {
const response = await fetch(`${config.baseURL}/finetune/validate_dataset_path`, {
method: 'POST',
body: formData,
headers: config.headers,
body: JSON.stringify({ dataset_path: datasetPath }),
});

if (!response.ok) {
const errorData = await response.json().catch(() => ({}));
throw new Error(errorData.detail || `Upload failed: ${response.status}`);
throw new Error(errorData.detail || `Validation failed: ${response.status}`);
}

return await response.json();
} catch (error) {
console.error('Error uploading dataset:', error);
console.error('Error validating dataset path:', error);
throw error;
}
};
Expand Down
6 changes: 3 additions & 3 deletions ModelForge/Frontend/build/asset-manifest.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"files": {
"main.css": "/static/css/main.9680427d.css",
"main.js": "/static/js/main.630cdb63.js",
"main.js": "/static/js/main.9df15fbf.js",
"static/js/453.ad6eb26e.chunk.js": "/static/js/453.ad6eb26e.chunk.js",
"index.html": "/index.html",
"main.9680427d.css.map": "/static/css/main.9680427d.css.map",
"main.630cdb63.js.map": "/static/js/main.630cdb63.js.map",
"main.9df15fbf.js.map": "/static/js/main.9df15fbf.js.map",
"453.ad6eb26e.chunk.js.map": "/static/js/453.ad6eb26e.chunk.js.map"
},
"entrypoints": [
"static/css/main.9680427d.css",
"static/js/main.630cdb63.js"
"static/js/main.9df15fbf.js"
]
}
2 changes: 1 addition & 1 deletion ModelForge/Frontend/build/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><title>ModelForge</title><script defer="defer" src="/static/js/main.630cdb63.js"></script><link href="/static/css/main.9680427d.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><title>ModelForge</title><script defer="defer" src="/static/js/main.9df15fbf.js"></script><link href="/static/css/main.9680427d.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
1 change: 0 additions & 1 deletion ModelForge/Frontend/build/static/js/main.630cdb63.js.map

This file was deleted.

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions ModelForge/Frontend/build/static/js/main.9df15fbf.js.map

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions ModelForge/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,15 @@ async def lifespan(app: FastAPI):
lifespan=lifespan,
)

cors_origins_env = os.getenv("CORS_ORIGINS", "http://localhost:8000")
origins = [origin.strip() for origin in cors_origins_env.split(",")]

# CORS middleware
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_origins=origins,
allow_methods=["*"],
allow_headers=["*"],
allow_credentials=True,
)


Expand Down
79 changes: 0 additions & 79 deletions ModelForge/app_old.py

This file was deleted.

Loading