From ac077a69a7abe964021cfd08471bf5f573c8d833 Mon Sep 17 00:00:00 2001 From: Devlin Date: Thu, 30 Jan 2025 12:35:20 -0800 Subject: [PATCH] use emoji --- src/create_lilypad_module/scaffold.py | 10 +++++----- .../templates/scripts/download_models.py | 2 +- .../templates/scripts/run_module.py | 5 +++-- .../templates/src/run_inference.py | 16 ++++++---------- 4 files changed, 15 insertions(+), 18 deletions(-) diff --git a/src/create_lilypad_module/scaffold.py b/src/create_lilypad_module/scaffold.py index 17c421f..912ebab 100644 --- a/src/create_lilypad_module/scaffold.py +++ b/src/create_lilypad_module/scaffold.py @@ -24,7 +24,7 @@ def initialize_git_repo(target_dir: Path) -> None: os.chdir(target_dir) subprocess.run(["git", "init"], check=True) except subprocess.CalledProcessError as error: - print(f"Error: Failed to initialize Git repository. {error}") + print(f"❌ Error: Failed to initialize Git repository. {error}") sys.exit(1) @@ -41,7 +41,7 @@ def copy_templates(target_dir: Path) -> None: templates_dir = Path(__file__).resolve().parent / "templates" if not templates_dir.is_dir(): - print(f"Error: Templates directory not found at {templates_dir}") + print(f"❌ Error: Templates directory not found at {templates_dir}") sys.exit(1) try: shutil.copytree( @@ -51,7 +51,7 @@ def copy_templates(target_dir: Path) -> None: ignore=shutil.ignore_patterns("__pycache__", "*.pyc"), ) except OSError as error: - print(f"Error copying templates: {error}") + print(f"❌ Error copying templates: {error}") sys.exit(1) @@ -68,7 +68,7 @@ def scaffold_project(project_name: str) -> None: target_dir = Path.cwd() / project_name if target_dir.exists(): - print(f"Error: Directory '{project_name}' already exists.") + print(f"❌ Error: Directory '{project_name}' already exists.") sys.exit(1) try: @@ -85,7 +85,7 @@ def scaffold_project(project_name: str) -> None: print(f"\n\t\033[38;2;20;199;195mcd\033[0m {project_name}") print(f"\nGLHF!") except Exception as error: - print(f"Error scaffolding project: {error}") + print(f"❌ Error scaffolding project: {error}") sys.exit(1) diff --git a/src/create_lilypad_module/templates/scripts/download_models.py b/src/create_lilypad_module/templates/scripts/download_models.py index 7577daa..66c05d5 100644 --- a/src/create_lilypad_module/templates/scripts/download_models.py +++ b/src/create_lilypad_module/templates/scripts/download_models.py @@ -13,7 +13,7 @@ def download_models(): model = AutoModelForSequenceClassification.from_pretrained(MODEL_IDENTIFIER) tokenizer.save_pretrained("./models") model.save_pretrained("./models") - print("Models downloaded successfully.") + print("✅ Models downloaded successfully.") except: print("❌ Error downloading models.") print("⛔️ Have you configured the download script?") diff --git a/src/create_lilypad_module/templates/scripts/run_module.py b/src/create_lilypad_module/templates/scripts/run_module.py index cd199a2..75a3ad1 100644 --- a/src/create_lilypad_module/templates/scripts/run_module.py +++ b/src/create_lilypad_module/templates/scripts/run_module.py @@ -61,10 +61,11 @@ def run_module(): try: result = subprocess.run(command, check=True, text=True) - print("Lilypad module executed successfully.") + print("✅ Lilypad module executed successfully.") + print(f"👉 {output_dir}/result.json") return result except subprocess.CalledProcessError as e: - print(f"An error occurred: {e}") + print(f"❌ Error: {e}") if __name__ == "__main__": diff --git a/src/create_lilypad_module/templates/src/run_inference.py b/src/create_lilypad_module/templates/src/run_inference.py index 71448b9..572a6e8 100644 --- a/src/create_lilypad_module/templates/src/run_inference.py +++ b/src/create_lilypad_module/templates/src/run_inference.py @@ -21,7 +21,7 @@ def run_job(input, model, tokenizer): return output except Exception as e: - print(f"Error running job: {e}", file=sys.stderr) + print(f"❌ Error running job: {e}", file=sys.stderr) traceback.print_exc(file=sys.stderr) raise @@ -45,14 +45,8 @@ def main(): } ) - print( - f"Output: {output}", - file=sys.stderr, - flush=True, - ) - except Exception as error: - print("Error during processing:", file=sys.stderr, flush=True) + print("❌ Error during processing:", file=sys.stderr, flush=True) traceback.print_exc(file=sys.stderr) output["error"] = str(error) @@ -63,10 +57,12 @@ def main(): with open(output_path, "w") as f: json.dump(output, f, indent=2) print( - f"Successfully wrote output to {output_path}", file=sys.stderr, flush=True + f"✅ Successfully wrote output to {output_path}", + file=sys.stderr, + flush=True, ) except Exception as error: - print(f"Error writing output file: {error}", file=sys.stderr, flush=True) + print(f"❌ Error writing output file: {error}", file=sys.stderr, flush=True) traceback.print_exc(file=sys.stderr)