Skip to content

Commit

Permalink
use emoji
Browse files Browse the repository at this point in the history
  • Loading branch information
DevlinRocha committed Jan 30, 2025
1 parent 1bf491f commit ac077a6
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 18 deletions.
10 changes: 5 additions & 5 deletions src/create_lilypad_module/scaffold.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand All @@ -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(
Expand All @@ -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)


Expand All @@ -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:
Expand All @@ -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)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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?")
Expand Down
5 changes: 3 additions & 2 deletions src/create_lilypad_module/templates/scripts/run_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__":
Expand Down
16 changes: 6 additions & 10 deletions src/create_lilypad_module/templates/src/run_inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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)

Expand All @@ -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)


Expand Down

0 comments on commit ac077a6

Please sign in to comment.