Spaces:
Sleeping
Sleeping
Tonic commited on
Fix model recovery and deployment scripts - add safetensors support and Windows compatibility
Browse filesFiles changed (2)
- cloud_deploy.py+9-6
- quick_deploy.pyAdded+72
6 unmodified lines78910111265 unmodified lines7879808182838485868788899091929394956 unmodified linesimport osimport sysimport loggingfrom pathlib import Path# Setup logging65 unmodified lineslogger.info(f"Running: {' '.join(cmd)}")# Run the commandresult = os.system(' '.join(cmd))if result == 0:logger.info("β Model deployment completed successfully!")logger.info(f"π View your model at: https://huggingface.co/{REPO_NAME}")logger.info("π Quantized models available at:")logger.info(f" - https://huggingface.co/{REPO_NAME}/int8 (GPU optimized)")logger.info(f" - https://huggingface.co/{REPO_NAME}/int4 (CPU optimized)")return 0else:logger.error("β Model deployment failed!")return 1if __name__ == "__main__":6 unmodified lines7891011121365 unmodified lines79808182838485868788899091929394959697986 unmodified linesimport osimport sysimport loggingimport subprocessfrom pathlib import Path# Setup logging65 unmodified lineslogger.info(f"Running: {' '.join(cmd)}")# Run the command using subprocess for better argument handlingtry:result = subprocess.run(cmd, check=True, capture_output=True, text=True)logger.info("β Model deployment completed successfully!")logger.info(f"π View your model at: https://huggingface.co/{REPO_NAME}")logger.info("π Quantized models available at:")logger.info(f" - https://huggingface.co/{REPO_NAME}/int8 (GPU optimized)")logger.info(f" - https://huggingface.co/{REPO_NAME}/int4 (CPU optimized)")return 0except subprocess.CalledProcessError as e:logger.error(f"β Model deployment failed!")logger.error(f"Error: {e}")logger.error(f"stdout: {e.stdout}")logger.error(f"stderr: {e.stderr}")return 1if __name__ == "__main__":
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172#!/usr/bin/env python3"""Quick Model Deployment ScriptDirect deployment without argument parsing issues"""
import osimport sysimport loggingfrom pathlib import Path
# Add src to path for importssys.path.append(os.path.join(os.path.dirname(__file__), 'src'))
# Setup logginglogging.basicConfig( level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')logger = logging.getLogger(__name__)
def main(): """Direct deployment without argument parsing""" # Configuration MODEL_PATH = "/output-checkpoint" REPO_NAME = "Tonic/smollm3-finetuned" HF_TOKEN = os.getenv('HF_TOKEN') if not HF_TOKEN: logger.error("β HF_TOKEN not set") return 1 if not Path(MODEL_PATH).exists(): logger.error(f"β Model path not found: {MODEL_PATH}") return 1 logger.info("β
Model files validated") # Import and run the recovery pipeline directly try: from recover_model import ModelRecoveryPipeline # Initialize pipeline pipeline = ModelRecoveryPipeline( model_path=MODEL_PATH, repo_name=REPO_NAME, hf_token=HF_TOKEN, private=False, quantize=True, quant_types=["int8_weight_only", "int4_weight_only"], author_name="Tonic", model_description="A fine-tuned SmolLM3 model for improved text generation and conversation capabilities" ) # Run the complete pipeline success = pipeline.run_complete_pipeline() if success: logger.info("β
Model deployment completed successfully!") logger.info(f"π View your model at: https://huggingface.co/{REPO_NAME}") return 0 else: logger.error("β Model deployment failed!") return 1 except Exception as e: logger.error(f"β Error during deployment: {e}") return 1
if __name__ == "__main__": exit(main())cloud_deploy.py+9-6
quick_deploy.pyAdded+72