Add Mac OS support for Apple Silicon (#770)
* Made an install script and auto updates env for mac * GPU sensors and initial training working for MAC. Still WIP. * Switch dataloader to single threaded until I can work around some mac pickeling issues. * Get quantization working on mac * Fix mac exclusive imports so they don't break other builds. * Add mac instructions to the UI
This commit is contained in:
@@ -19,6 +19,7 @@ import SampleControlImage from '@/components/SampleControlImage';
|
||||
import { FlipHorizontal2, FlipVertical2 } from 'lucide-react';
|
||||
import { handleModelArchChange } from './utils';
|
||||
import { IoFlaskSharp } from 'react-icons/io5';
|
||||
import { isMac } from '@/helpers/basic';
|
||||
|
||||
type Props = {
|
||||
jobConfig: JobConfig;
|
||||
@@ -146,6 +147,8 @@ export default function SimpleJob({
|
||||
return newQuantizationOptions;
|
||||
}, [modelArch]);
|
||||
|
||||
const showGPUSelect = !isMac();
|
||||
|
||||
return (
|
||||
<>
|
||||
<form
|
||||
@@ -171,13 +174,15 @@ export default function SimpleJob({
|
||||
disabled={runId !== null}
|
||||
required
|
||||
/>
|
||||
<SelectInput
|
||||
label="GPU ID"
|
||||
value={`${gpuIDs}`}
|
||||
docKey="gpuids"
|
||||
onChange={value => setGpuIDs(value)}
|
||||
options={gpuList.map((gpu: any) => ({ value: `${gpu.index}`, label: `GPU #${gpu.index}` }))}
|
||||
/>
|
||||
{showGPUSelect && (
|
||||
<SelectInput
|
||||
label="GPU ID"
|
||||
value={`${gpuIDs}`}
|
||||
docKey="gpuids"
|
||||
onChange={value => setGpuIDs(value)}
|
||||
options={gpuList.map((gpu: any) => ({ value: `${gpu.index}`, label: `GPU #${gpu.index}` }))}
|
||||
/>
|
||||
)}
|
||||
{disableSections.includes('trigger_word') ? null : (
|
||||
<TextInput
|
||||
label="Trigger Word"
|
||||
@@ -249,7 +254,7 @@ export default function SimpleJob({
|
||||
onChange={value => setJobConfig(value, 'config.process[0].model.model_kwargs.match_target_res')}
|
||||
/>
|
||||
)}
|
||||
{modelArch?.additionalSections?.includes('model.layer_offloading') && (
|
||||
{modelArch?.additionalSections?.includes('model.layer_offloading') && !isMac() && (
|
||||
<>
|
||||
<Checkbox
|
||||
label={
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
'use client';
|
||||
import { isMac } from '@/helpers/basic';
|
||||
import { JobConfig, DatasetConfig, SliderConfig } from '@/types';
|
||||
|
||||
export const defaultDatasetConfig: DatasetConfig = {
|
||||
@@ -199,5 +201,9 @@ export const migrateJobConfig = (jobConfig: JobConfig): JobConfig => {
|
||||
use_ui_logger: true,
|
||||
};
|
||||
}
|
||||
if (isMac()) {
|
||||
jobConfig.config.process[0].device = 'mps';
|
||||
}
|
||||
|
||||
return jobConfig;
|
||||
};
|
||||
|
||||
@@ -35,7 +35,7 @@ export default function TrainingForm() {
|
||||
const [datasetOptions, setDatasetOptions] = useState<{ value: string; label: string }[]>([]);
|
||||
const [showAdvancedView, setShowAdvancedView] = useState(false);
|
||||
|
||||
const [jobConfig, setJobConfig] = useNestedState<JobConfig>(objectCopy(defaultJobConfig));
|
||||
const [jobConfig, setJobConfig] = useNestedState<JobConfig>(objectCopy(migrateJobConfig(defaultJobConfig)));
|
||||
const [status, setStatus] = useState<'idle' | 'saving' | 'success' | 'error'>('idle');
|
||||
const fileInputRef = useRef<HTMLInputElement>(null);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user