Add support for MiniMax H3 T2V and I2V training
This commit is contained in:
@@ -3,7 +3,7 @@ import { Job } from '@prisma/client';
|
||||
import { spawn, ChildProcess } from 'child_process';
|
||||
import path from 'path';
|
||||
import fs from 'fs';
|
||||
import { TOOLKIT_ROOT, getTrainingFolder, getHFToken } from '../paths';
|
||||
import { TOOLKIT_ROOT, getTrainingFolder, getHFToken, getModelsPath } from '../paths';
|
||||
import { resolveDetachedPythonPath } from '../pythonPath';
|
||||
const isWindows = process.platform === 'win32';
|
||||
|
||||
@@ -250,6 +250,15 @@ const startAndWatchJob = (job: Job) => {
|
||||
additionalEnv.HF_TOKEN = hfToken;
|
||||
}
|
||||
|
||||
// MODELS_PATH - one set in the env always takes precedence (it passes
|
||||
// through via process.env); only fall back to the setting if it is not set
|
||||
if (!process.env.MODELS_PATH || process.env.MODELS_PATH.trim() === '') {
|
||||
const modelsPath = await getModelsPath();
|
||||
if (modelsPath && modelsPath.trim() !== '') {
|
||||
additionalEnv.MODELS_PATH = modelsPath;
|
||||
}
|
||||
}
|
||||
|
||||
const args = [runFilePath, configPath];
|
||||
|
||||
// Where the Windows relay reports the job's real pid back to us.
|
||||
|
||||
@@ -5,6 +5,7 @@ export const TOOLKIT_ROOT = path.resolve('@', '..', '..');
|
||||
export const defaultTrainFolder = path.join(TOOLKIT_ROOT, 'output');
|
||||
export const defaultDatasetsFolder = path.join(TOOLKIT_ROOT, 'datasets');
|
||||
export const defaultDataRoot = path.join(TOOLKIT_ROOT, 'data');
|
||||
export const defaultModelsFolder = path.join(TOOLKIT_ROOT, 'models');
|
||||
|
||||
// Forked file-server workers set AI_TOOLKIT_QUIET_PATHS so this line prints
|
||||
// once per launched process group, not once per worker.
|
||||
@@ -39,3 +40,17 @@ export const getHFToken = async () => {
|
||||
}
|
||||
return token;
|
||||
};
|
||||
|
||||
export const getModelsPath = async () => {
|
||||
const key = 'MODELS_PATH';
|
||||
let row = await prisma.settings.findFirst({
|
||||
where: {
|
||||
key: key,
|
||||
},
|
||||
});
|
||||
let modelsPath = '';
|
||||
if (row?.value && row.value !== '' && row.value !== defaultModelsFolder) {
|
||||
modelsPath = row.value;
|
||||
}
|
||||
return modelsPath;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user