Merge branch 'main' into flux2

This commit is contained in:
Jaret Burkett
2025-11-23 08:18:35 -07:00
4 changed files with 21 additions and 4 deletions

View File

@@ -99,7 +99,10 @@ def _ensure_cpu_pinned(t: Optional[torch.Tensor]) -> Optional[torch.Tensor]:
if t is None: if t is None:
return None return None
if t.device.type != "cpu": if t.device.type != "cpu":
t = t.to("cpu", copy=True) try:
t = t.to("cpu", copy=True)
except Exception:
t = t.to("cpu")
# Don't attempt to pin quantized tensors; many backends don't support it # Don't attempt to pin quantized tensors; many backends don't support it
if _is_quantized_tensor(t): if _is_quantized_tensor(t):
return t return t

View File

@@ -47,6 +47,7 @@ def unload_text_encoder(model: "BaseModel"):
if hasattr(pipe, "text_encoder"): if hasattr(pipe, "text_encoder"):
te = FakeTextEncoder(device=model.device_torch, dtype=model.torch_dtype) te = FakeTextEncoder(device=model.device_torch, dtype=model.torch_dtype)
text_encoder_list.append(te) text_encoder_list.append(te)
pipe.text_encoder.to('cpu')
pipe.text_encoder = te pipe.text_encoder = te
i = 2 i = 2

View File

@@ -102,7 +102,7 @@ export default function JobsTable({ onlyActive = false }: JobsTableProps) {
jd['Idle'] = { name: 'Idle', jobs: [] }; jd['Idle'] = { name: 'Idle', jobs: [] };
jobs.forEach(job => { jobs.forEach(job => {
const gpu = gpuList.find(gpu => job.gpu_ids?.split(',').includes(gpu.index.toString())) as GpuInfo; const gpu = gpuList.find(gpu => job.gpu_ids?.split(',').includes(gpu.index.toString())) as GpuInfo;
const key = `${gpu.index}`; const key = `${gpu?.index || '0'}`;
if (['queued', 'running', 'stopping'].includes(job.status) && key in jd) { if (['queued', 'running', 'stopping'].includes(job.status) && key in jd) {
jd[key].jobs.push(job); jd[key].jobs.push(job);
} else { } else {

View File

@@ -46,10 +46,21 @@ export default function SampleImageViewer({
const onCancel = useCallback(() => setIsOpen(false), []); const onCancel = useCallback(() => setIsOpen(false), []);
const imgInfo = useMemo(() => { const imgInfo = useMemo(() => {
// handle windows C:\\Apps\\AI-Toolkit\\AI-Toolkit\\output\\LoRA-Name\\samples\\1763563000704__000004000_0.jpg
const ii = { filename: '', step: 0, promptIdx: 0 }; const ii = { filename: '', step: 0, promptIdx: 0 };
if (imgPath) { if (imgPath) {
const filename = imgPath.split('/').pop(); // handle windows
if (!filename) return ii; let filename: string | null = null;
if (imgPath.includes('\\')) {
const parts = imgPath.split('\\');
filename = parts[parts.length - 1];
} else {
filename = imgPath.split('/').pop() || null;
}
if (!filename) {
console.error('Filename could not be determined from imgPath:', imgPath);
return ii;
}
ii.filename = filename; ii.filename = filename;
const parts = filename const parts = filename
.split('.')[0] .split('.')[0]
@@ -58,6 +69,8 @@ export default function SampleImageViewer({
if (parts.length === 3) { if (parts.length === 3) {
ii.step = parseInt(parts[1]); ii.step = parseInt(parts[1]);
ii.promptIdx = parseInt(parts[2]); ii.promptIdx = parseInt(parts[2]);
} else {
console.error('Unexpected filename format for sample image:', filename);
} }
} }
return ii; return ii;