Julian Bilcke commited on
Commit ·
608088a
1
Parent(s): 3f5a4ba
adding some logs to investigate
Browse files1663 unmodified lines16641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716888 unmodified lines169716981699170017011702170317041705170617071708170917101 unmodified line171217131714171517161717171834 unmodified lines17531754175517561757175817591663 unmodified lines# Check in lora_weights directorylora_weights_dir = self.app.output_path / "lora_weights"if lora_weights_dir.exists():#logger.info(f"Found lora_weights directory: {lora_weights_dir}")# Look for the latest checkpoint directory in lora_weightslora_checkpoints = [d for d in lora_weights_dir.glob("*") if d.is_dir() and d.name.isdigit()]if lora_checkpoints:latest_lora_checkpoint = max(lora_checkpoints, key=lambda x: int(x.name))#logger.info(f"Found latest LoRA checkpoint: {latest_lora_checkpoint}")# Extract step count from directory nameresult["steps"] = int(latest_lora_checkpoint.name)# List contents of the latest checkpoint directorycheckpoint_contents = list(latest_lora_checkpoint.glob("*"))#logger.info(f"Contents of LoRA checkpoint {latest_lora_checkpoint.name}: {checkpoint_contents}")# Check for weights in the latest LoRA checkpointlora_safetensors = latest_lora_checkpoint / "pytorch_lora_weights.safetensors"if lora_safetensors.exists():#logger.info(f"Found weights in latest LoRA checkpoint: {lora_safetensors}")result["path"] = str(lora_safetensors)return result8 unmodified linesfor weight_file in possible_weight_files:weight_path = latest_lora_checkpoint / weight_fileif weight_path.exists():#logger.info(f"Found weights file {weight_file} in latest LoRA checkpoint: {weight_path}")result["path"] = str(weight_path)return result# Check if any .safetensors files existsafetensors_files = list(latest_lora_checkpoint.glob("*.safetensors"))if safetensors_files:#logger.info(f"Found .safetensors files in LoRA checkpoint: {safetensors_files}")# Return the first .safetensors file foundresult["path"] = str(safetensors_files[0])return result1 unmodified line# Fallback: check for direct safetensors file in lora_weights rootlora_safetensors = lora_weights_dir / "pytorch_lora_weights.safetensors"if lora_safetensors.exists():#logger.info(f"Found weights in lora_weights directory: {lora_safetensors}")result["path"] = str(lora_safetensors)return resultelse:34 unmodified linesReturns:Path to safetensors file or None if not found"""return self.get_model_output_info()["path"]def create_training_dataset_zip(self) -> str:"""Create a ZIP file containing all training data1663 unmodified lines16641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716888 unmodified lines169716981699170017011702170317041705170617071708170917101 unmodified line171217131714171517161717171834 unmodified lines17531754175517561757175817591760176117621663 unmodified lines# Check in lora_weights directorylora_weights_dir = self.app.output_path / "lora_weights"if lora_weights_dir.exists():logger.info(f"Found lora_weights directory: {lora_weights_dir}")# Look for the latest checkpoint directory in lora_weightslora_checkpoints = [d for d in lora_weights_dir.glob("*") if d.is_dir() and d.name.isdigit()]if lora_checkpoints:latest_lora_checkpoint = max(lora_checkpoints, key=lambda x: int(x.name))logger.info(f"Found latest LoRA checkpoint: {latest_lora_checkpoint}")# Extract step count from directory nameresult["steps"] = int(latest_lora_checkpoint.name)# List contents of the latest checkpoint directorycheckpoint_contents = list(latest_lora_checkpoint.glob("*"))logger.info(f"Contents of LoRA checkpoint {latest_lora_checkpoint.name}: {checkpoint_contents}")# Check for weights in the latest LoRA checkpointlora_safetensors = latest_lora_checkpoint / "pytorch_lora_weights.safetensors"if lora_safetensors.exists():logger.info(f"Found weights in latest LoRA checkpoint: {lora_safetensors}")result["path"] = str(lora_safetensors)return result8 unmodified linesfor weight_file in possible_weight_files:weight_path = latest_lora_checkpoint / weight_fileif weight_path.exists():logger.info(f"Found weights file {weight_file} in latest LoRA checkpoint: {weight_path}")result["path"] = str(weight_path)return result# Check if any .safetensors files existsafetensors_files = list(latest_lora_checkpoint.glob("*.safetensors"))if safetensors_files:logger.info(f"Found .safetensors files in LoRA checkpoint: {safetensors_files}")# Return the first .safetensors file foundresult["path"] = str(safetensors_files[0])return result1 unmodified line# Fallback: check for direct safetensors file in lora_weights rootlora_safetensors = lora_weights_dir / "pytorch_lora_weights.safetensors"if lora_safetensors.exists():logger.info(f"Found weights in lora_weights directory: {lora_safetensors}")result["path"] = str(lora_safetensors)return resultelse:34 unmodified linesReturns:Path to safetensors file or None if not found"""path = self.get_model_output_info()["path"]if not path:raise gr.Error("No model weights found. Please train a model first.")return pathdef create_training_dataset_zip(self) -> str:"""Create a ZIP file containing all training data
vms/ui/project/services/training.py+11-8