Skip to content

Commit

Permalink
resolved conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
ersi-lightly committed Nov 20, 2023
2 parents dc4297d + 9f2ed93 commit 5703370
Show file tree
Hide file tree
Showing 10 changed files with 683 additions and 4 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/discord_release_notification.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Discord Release Notification

on:
release:
types: [published]

jobs:
notify-discord:
runs-on: ubuntu-latest
steps:
- name: Send Notification to Discord
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
# We truncate the description at the models section (starting with ### Models)
# to keep the message short.
# We have also have to format the release description for it to be valid JSON.
# This is done by piping the description to jq.
run: |
DESCRIPTION=$(echo '${{ github.event.release.body }}' | awk '/### Models/{exit}1' | jq -aRs .)
curl -H "Content-Type: application/json" \
-X POST \
-d @- \
"${DISCORD_WEBHOOK}" << EOF
{
"username": "Lightly",
"avatar_url": "https://avatars.githubusercontent.com/u/50146475",
"content": "Lightly ${{ github.event.release.tag_name }} has been released!",
"embeds": [
{
"title": "${{ github.event.release.name }}",
"url": "${{ github.event.release.html_url }}",
"color": 5814783,
"description": $DESCRIPTION
}
]
}
EOF
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
[![PyPI](https://img.shields.io/pypi/v/lightly)](https://pypi.org/project/lightly/)
[![Downloads](https://static.pepy.tech/badge/lightly)](https://pepy.tech/project/lightly)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Discord](https://img.shields.io/discord/752876370337726585?logo=discord&logoColor=white&label=discord&color=7289da)](https://discord.gg/xvNJW94)


Lightly SSL is a computer vision framework for self-supervised learning.

Expand Down
2 changes: 1 addition & 1 deletion lightly/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
# All Rights Reserved

__name__ = "lightly"
__version__ = "1.4.20"
__version__ = "1.4.21"


import os
Expand Down
53 changes: 53 additions & 0 deletions lightly/api/api_workflow_artifacts.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import warnings

from lightly.api import download
from lightly.openapi_generated.swagger_client.models import (
Expand Down Expand Up @@ -145,6 +146,10 @@ def download_compute_worker_run_report_json(
) -> None:
"""Download the report in json format from a run.
DEPRECATED: This method is deprecated and will be removed in the future. Use
download_compute_worker_run_report_v2_json to download the new report_v2.json
instead.
Args:
run:
Run from which to download the report.
Expand All @@ -171,13 +176,61 @@ def download_compute_worker_run_report_json(
>>> client.download_compute_worker_run_report_json(run=run, output_path="report.json")
"""
warnings.warn(
DeprecationWarning(
"This method downloads the deprecated report.json file and will be "
"removed in the future. Use download_compute_worker_run_report_v2_json "
"to download the new report_v2.json file instead."
)
)
self._download_compute_worker_run_artifact_by_type(
run=run,
artifact_type=DockerRunArtifactType.REPORT_JSON,
output_path=output_path,
timeout=timeout,
)

def download_compute_worker_run_report_v2_json(
self,
run: DockerRunData,
output_path: str,
timeout: int = 60,
) -> None:
"""Download the report in json format from a run.
Args:
run:
Run from which to download the report.
output_path:
Path where report will be saved.
timeout:
Timeout in seconds after which download is interrupted.
Raises:
ArtifactNotExist:
If the run has no report artifact or the report has not yet been
uploaded.
Examples:
>>> # schedule run
>>> scheduled_run_id = client.schedule_compute_worker_run(...)
>>>
>>> # wait until run completed
>>> for run_info in client.compute_worker_run_info_generator(scheduled_run_id=scheduled_run_id):
>>> pass
>>>
>>> # download checkpoint
>>> run = client.get_compute_worker_run_from_scheduled_run(scheduled_run_id=scheduled_run_id)
>>> client.download_compute_worker_run_report_v2_json(run=run, output_path="report_v2.json")
"""
self._download_compute_worker_run_artifact_by_type(
run=run,
artifact_type=DockerRunArtifactType.REPORT_V2_JSON,
output_path=output_path,
timeout=timeout,
)

def download_compute_worker_run_log(
self,
run: DockerRunData,
Expand Down
Loading

0 comments on commit 5703370

Please sign in to comment.