-
Notifications
You must be signed in to change notification settings - Fork 14
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
Blue hawk demo #1197
Open
ngrayluna
wants to merge
5
commits into
main
Choose a base branch
from
blue_hawk_demo
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Blue hawk demo #1197
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
14aef14
GPT Editor improvement: Properly align suggestions (#1196)
johndmulhausen 944ae1e
First draft of BlueHawk code checker
ngrayluna 8bd3a26
updates scripts output
ngrayluna 011aada
Updated source path
ngrayluna ff83f15
Fixed requirements.txt file paht
ngrayluna File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: Test W&B Doc Code Snippets | ||
on: [pull_request] | ||
|
||
jobs: | ||
generate-matrix: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
scripts: ${{ steps.list-scripts.outputs.scripts }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Find Python scripts | ||
id: list-scripts | ||
run: | | ||
SCRIPTS=$(find code_examples/source -name "*.py" | jq -R -s -c 'split("\n")[:-1]') | ||
echo "scripts=$SCRIPTS" >> $GITHUB_ENV | ||
echo "::set-output name=scripts::$SCRIPTS" | ||
|
||
test: | ||
needs: generate-matrix | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
script: ${{ fromJson(needs.generate-matrix.outputs.scripts) }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.10" | ||
|
||
- name: Install and check dependencies | ||
run: bash code_examples/check_dependencies.sh | ||
|
||
- name: Run W&B script | ||
run: python3 ${{ matrix.script }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
REQUIREMENTS_PATH="code_examples/requirements.txt" | ||
pip install -r "$REQUIREMENTS_PATH" && echo "All packages installed successfully!" || echo "Installation failed." | ||
|
||
python -c "import pkgutil; import sys; packages = [pkg.strip() for pkg in open('$REQUIREMENTS_PATH')]; missing = [p for p in packages if not pkgutil.find_loader(p)]; sys.exit(1) if missing else print('✅ All packages are installed.')" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
wandb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import wandb | ||
import random | ||
|
||
wandb.login() | ||
|
||
epochs = 10 | ||
lr = 0.01 | ||
|
||
run = wandb.init( | ||
project="my-awesome-project", # Specify your project | ||
config={ # Track hyperparameters and metadata | ||
"learning_rate": lr, | ||
"epochs": epochs, | ||
}, | ||
) | ||
|
||
offset = random.random() / 5 | ||
print(f"lr: {lr}") | ||
|
||
# Simulate a training run | ||
for epoch in range(2, epochs): | ||
acc = 1 - 2**-epoch - random.random() / epoch - offset | ||
loss = 2**-epoch + random.random() / epoch + offset | ||
print(f"epoch={epoch}, accuracy={acc}, loss={loss}") | ||
wandb.log({"accuracy": acc, "loss": loss}) | ||
run.finish() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import wandb | ||
import random |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
run = wandb.init( | ||
project="my-awesome-project", # Specify your project | ||
config={ # Track hyperparameters and metadata | ||
"learning_rate": lr, | ||
"epochs": epochs, | ||
}, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
wandb.login() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/usr/bin/env python3 | ||
|
||
try: | ||
# :snippet-start: all | ||
# :snippet-start: import | ||
import wandb | ||
import random | ||
# :snippet-end: import | ||
|
||
# :snippet-start: login | ||
wandb.login() | ||
# :snippet-end: login | ||
|
||
epochs = 10 | ||
lr = 0.01 | ||
|
||
# :snippet-start: init | ||
run = wandb.init( | ||
project="my-awesome-project", # Specify your project | ||
config={ # Track hyperparameters and metadata | ||
"learning_rate": lr, | ||
"epochs": epochs, | ||
}, | ||
) | ||
# :snippet-end: init | ||
|
||
offset = random.random() / 5 | ||
print(f"lr: {lr}") | ||
|
||
# Simulate a training run | ||
for epoch in range(2, epochs): | ||
acc = 1 - 2**-epoch - random.random() / epoch - offset | ||
loss = 2**-epoch + random.random() / epoch + offset | ||
print(f"epoch={epoch}, accuracy={acc}, loss={loss}") | ||
wandb.log({"accuracy": acc, "loss": loss}) | ||
run.finish() | ||
# :snippet-end: all | ||
exit(0) | ||
except Exception as e: | ||
print(f"Error: {e}") | ||
exit(1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{{ $language := .Get "language" }} | ||
{{ $source := .Get "source" }} | ||
{{ $options := .Get "options" }} | ||
|
||
{{ with $source | readFile }} | ||
{{ highlight (trim . "\n\r") $language $options }} | ||
{{ end }} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This is a bit greedy. At a minimum I'd add
-type f
so you don't find directories that end in.py
. I'm also confused why you have to take something that is going to be multi-line input with one result per line, join it up, and then split it again right away?