Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added lightning studio check #2910

Merged
merged 5 commits into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/e2e_nlp/.copier-answers.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Changes here will be overwritten by Copier
_commit: 2024.06.14
_commit: 2024.08.07
_src_path: gh:zenml-io/template-nlp
accelerator: cpu
cloud_of_choice: aws
Expand Down
2 changes: 1 addition & 1 deletion examples/e2e_nlp/gradio/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ datasets==2.12.0
numpy==1.22.4
pandas==1.5.3
session_info==1.0.0
scikit-learn==1.2.2
scikit-learn==1.5.0
transformers==4.28.1
IPython==7.34.0
2 changes: 1 addition & 1 deletion examples/e2e_nlp/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
torchvision
accelerate
gradio
zenml[server]==0.56.3
zenml[server]>=0.56.3
1 change: 1 addition & 0 deletions src/zenml/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ class EnvironmentType(StrEnum):
NOTEBOOK = "notebook"
PAPERSPACE = "paperspace"
WSL = "wsl"
LIGHTNING_AI_STUDIO = "lightning_ai_studio"


class ModelStages(StrEnum):
Expand Down
15 changes: 15 additions & 0 deletions src/zenml/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ def get_environment() -> str:
return EnvironmentType.BITBUCKET_CI
elif Environment.in_ci():
return EnvironmentType.GENERIC_CI
elif Environment.in_lightning_ai_studio():
return EnvironmentType.LIGHTNING_AI_STUDIO
elif Environment.in_docker():
return EnvironmentType.DOCKER
elif Environment.in_container():
Expand Down Expand Up @@ -339,6 +341,19 @@ def in_wsl() -> bool:
"""
return "microsoft-standard" in platform.uname().release

@staticmethod
def in_lightning_ai_studio() -> bool:
"""If the current Python process is running in Lightning.ai studios.

Returns:
`True` if the current Python process is running in Lightning.ai studios,
`False` otherwise.
"""
return (
"LIGHTNING_CLOUD_URL" in os.environ
and "LIGHTNING_CLOUDSPACE_HOST" in os.environ
)

def register_component(
self, component: "BaseEnvironmentComponent"
) -> "BaseEnvironmentComponent":
Expand Down