-
Notifications
You must be signed in to change notification settings - Fork 1
Example: update quickstart with latest features #20
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
Conversation
Reviewer's GuideThis PR enriches the Quickstart guides by adding histogram‐based distribution logging in both notebook and script examples—introducing sampling utilities, leveraging the Neptune Histogram API in per‐step loops, parameterizing layer count, adding a download_file helper for external assets, and updating notebook content and metadata to reflect the new capabilities. Class diagram for new and updated utilities in QuickstartclassDiagram
class Histogram {
+bin_edges: np.ndarray
+counts: np.ndarray
}
class Run {
+log_histograms(histograms: dict, step: int)
+log_files(files: dict, step: int)
+log_string_series(data: dict, step: int)
+assign_files(files: dict)
+add_tags(tags: list, group_tags: bool)
+close()
}
class QuickstartUtils {
+get_gradient_norm(layer: int, step: int): float
+get_activation_distribution(layer: int, step: int): tuple[np.ndarray, np.ndarray]
+get_gpu_utilization(step: int): float
+download_file(url: str, filename: str): None
}
Run --> Histogram : uses
QuickstartUtils --> Histogram : creates
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @LeoRoccoBreedt - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟡 General issues: 1 issue found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
@LeoRoccoBreedt - left a single comment, and pushed a few changes to account for the latest release: Summary of code changes:
Also made some changes to the UI elements:
Lemme know what you think |
@sourcery-ai review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @LeoRoccoBreedt - I've reviewed your changes and they look great!
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location> `how-to-guides/quickstart/scripts/neptune_quickstart.py:130` </location>
<code_context>
)
+
+ # Download sample files
+ response = requests.get(
+ "https://neptune.ai/wp-content/uploads/2024/05/blog_feature_image_046799_8_3_7_3-4.jpg"
+ )
+ response.raise_for_status()
+ with open("sample.png", "wb") as f:
+ f.write(response.content)
+ response = requests.get("https://neptune.ai/wp-content/uploads/2025/05/sac-rl.mp4")
+ response.raise_for_status()
</code_context>
<issue_to_address>
Repeated code for downloading files could be refactored.
Extract the repeated download logic into a helper function for better maintainability.
</issue_to_address>
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
…nhance logging functionality. Introduced a dedicated `download_file` function for improved code clarity and maintainability.
…scale-examples into lb/update_quickstart
@sourcery-ai review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @LeoRoccoBreedt - I've reviewed your changes - here's some feedback:
- Consider abstracting the repeated histogram-logging loops into a shared helper to reduce duplication between the notebook and script.
- Logging histograms on every single step (20k/2k steps) may overwhelm a quickstart; consider sampling or capping steps for demonstration purposes.
- Please verify that all sample multimedia download URLs (e.g., those with “2025”) are correct and accessible to avoid broken links during the quickstart.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider abstracting the repeated histogram-logging loops into a shared helper to reduce duplication between the notebook and script.
- Logging histograms on every single step (20k/2k steps) may overwhelm a quickstart; consider sampling or capping steps for demonstration purposes.
- Please verify that all sample multimedia download URLs (e.g., those with “2025”) are correct and accessible to avoid broken links during the quickstart.
## Individual Comments
### Comment 1
<location> `how-to-guides/quickstart/scripts/neptune_quickstart.py:65` </location>
<code_context>
return accuracy, loss
+def download_file(url: str, filename: str) -> None:
+ response = requests.get(url)
+ response.raise_for_status()
</code_context>
<issue_to_address>
Consider adding a timeout to the requests.get call in download_file.
Without a timeout, the function may hang if the server is unresponsive. Adding a timeout will improve reliability.
</issue_to_address>
<suggested_fix>
<<<<<<< SEARCH
def download_file(url: str, filename: str) -> None:
response = requests.get(url)
response.raise_for_status()
with open(filename, "wb") as f:
f.write(response.content)
=======
def download_file(url: str, filename: str) -> None:
response = requests.get(url, timeout=10)
response.raise_for_status()
with open(filename, "wb") as f:
f.write(response.content)
>>>>>>> REPLACE
</suggested_fix>
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com> Signed-off-by: Siddhant Sadangi <siddhant.sadangi@gmail.com>
@sourcery-ai review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @LeoRoccoBreedt - I've reviewed your changes and they look great!
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location> `how-to-guides/quickstart/notebooks/neptune_quickstart.ipynb:32` </location>
<code_context>
- "- Log configuration values and metrics to the run\n"
+ "- Log the following:\n",
+ " - configuration values and metrics to the run\n",
+ " - files and series of files\n",
+ " - logs of custom string series\n",
+ " - series of histograms"
]
},
</code_context>
<issue_to_address>
The updated guide outline could clarify the distinction between 'files' and 'series of files'.
If there's a specific difference between 'files' and 'series of files', please clarify it in the guide to prevent confusion.
</issue_to_address>
<suggested_fix>
<<<<<<< SEARCH
"- Log the following:\n",
" - configuration values and metrics to the run\n",
" - files and series of files\n",
" - logs of custom string series\n",
" - series of histograms"
=======
"- Log the following:\n",
" - configuration values and metrics to the run\n",
" - individual files (e.g., a single model checkpoint or image)\n",
" - series of files (e.g., a sequence of model checkpoints or images over epochs)\n",
" - logs of custom string series\n",
" - series of histograms"
>>>>>>> REPLACE
</suggested_fix>
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR enhances the Quickstart examples by introducing histogram logging for activation distributions, a helper to download external assets, and parameterizes the number of simulated layers.
- Add
NUM_LAYERS
constant and update loops to use it instead of hard-coded values - Implement
download_file
utility and use it to fetch sample assets - Introduce histogram logging (series of
Histogram
objects) in both script and notebook
Reviewed Changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
how-to-guides/quickstart/scripts/neptune_quickstart.py | Add download_file , NUM_LAYERS , and histogram logging loop; update loops to use NUM_LAYERS |
how-to-guides/quickstart/notebooks/neptune_quickstart.ipynb | Update notebook to include histogram section, adjust imports and kernel metadata, and parameterize layers |
Comments suppressed due to low confidence (3)
how-to-guides/quickstart/scripts/neptune_quickstart.py:185
- The new histogram logging feature isn't covered by existing tests; consider adding unit or integration tests to verify that
log_histograms
is called with correct histogram data.
# Log series of histograms
how-to-guides/quickstart/notebooks/neptune_quickstart.ipynb:544
- The notebook kernel version is set to Python 3.9.13, which differs from the script's Python 3.12 target. Consider aligning the kernel version to match project requirements for consistency.
"version": "3.9.13"
how-to-guides/quickstart/notebooks/neptune_quickstart.ipynb:483
- The
trange
function is used but not imported in this cell, which will cause a NameError at execution time. Add the appropriate import (e.g.,from tqdm import trange
).
"for step in trange(NUM_STEPS):\n",
Signed-off-by: Siddhant Sadangi <siddhant.sadangi@neptune.ai>
Co-authored-by: Sabine Ståhlberg <sabine.stahlberg@neptune.ai> Signed-off-by: Leo Breedt <101509998+LeoRoccoBreedt@users.noreply.github.com>
Co-authored-by: Sabine Ståhlberg <sabine.stahlberg@neptune.ai> Signed-off-by: Leo Breedt <101509998+LeoRoccoBreedt@users.noreply.github.com>
Description
Include a summary of the changes and the related issue.
Related to: <ClickUp/JIRA task name>
Any expected test failures?
Add a
[X]
to relevant checklist items❔ This change
✔️ Pre-merge checklist
🧪 Test Configuration
Summary by Sourcery
Add histogram logging to the Neptune quickstart examples, parameterize layer count, and introduce a utility to download external media files, along with associated guide and metadata updates.
New Features:
Enhancements:
Documentation: