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

Dev-update #59

Closed
wants to merge 61 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
0eadc3b
added upload data to miner hf utils. Add upload data whenever miner r…
peterc-yuma Dec 11, 2024
d1d98ce
update challenge to accept a decrytion key. Data should now be encrypted
peterc-yuma Dec 11, 2024
fe7701a
decrypt data and upload to foundryservices dataset
peterc-yuma Dec 11, 2024
8e6cdcd
update decrypt_data
peterc-yuma Dec 11, 2024
3fcae57
update decryption_key to be bytes
peterc-yuma Dec 11, 2024
06dfca4
fix deserialization of decription key
peterc-yuma Dec 11, 2024
17b7af8
updated path for decryption to be the full path to the miners encrypt…
peterc-yuma Dec 11, 2024
418294d
ensure that decryption works from hf path
peterc-yuma Dec 11, 2024
b1f10fe
add logging
peterc-yuma Dec 11, 2024
246de6e
ensure proper format for repo_id when downloading from huggingface
peterc-yuma Dec 11, 2024
5203abd
Update forward.py to decrypt data properly
peterc-yuma Dec 12, 2024
ac72f53
add logging for key
peterc-yuma Dec 12, 2024
752fdc6
add decryption and upload for 146
peterc-yuma Dec 13, 2024
2f4f488
add decryption and upload for 146
peterc-yuma Dec 13, 2024
c51e0d6
add logging to forward
peterc-yuma Dec 13, 2024
47b920f
more logging
peterc-yuma Dec 13, 2024
f7c07a2
try to get correct path for downloading hf data
peterc-yuma Dec 13, 2024
30e4334
more logging
peterc-yuma Dec 13, 2024
a94910a
hopefully can actually download data from miner repo
peterc-yuma Dec 13, 2024
c720675
update store_data
peterc-yuma Dec 13, 2024
970b25b
update temporary file creation
peterc-yuma Dec 13, 2024
ba197fa
updated dataset manager to use hfapi only
peterc-yuma Dec 13, 2024
24b19d4
add hotkey to dataset file structure
peterc-yuma Dec 13, 2024
ada6812
remove nested folder
peterc-yuma Dec 13, 2024
74bf79d
generalize the data decryption and upload
peterc-yuma Dec 13, 2024
c5f1e5a
add back the model confirmation check for scoring miners
peterc-yuma Dec 16, 2024
ccd90a5
remove unecessary logs
peterc-yuma Dec 16, 2024
0284664
Add better docstrings to miner_hf.py functions
peterc-yuma Dec 16, 2024
fd97de6
update file type to be parquet
peterc-yuma Dec 16, 2024
45a3c24
update file type to be parquet
peterc-yuma Dec 16, 2024
3c6efca
update dataset_manager to properly instantiate hf git repo
peterc-yuma Dec 16, 2024
6e2a23b
update forward to check daily for files to upload after market close
peterc-yuma Dec 16, 2024
74f064a
replace print statemtents with bittensor logging in dataset_manager.py
peterc-yuma Dec 16, 2024
d5af897
add unit test for dataset_manager
peterc-yuma Dec 16, 2024
8505612
ensure that data upload can scale to 200 plus miners
peterc-yuma Dec 17, 2024
7ec96d3
incorporate data decryption into the reward structure
peterc-yuma Dec 17, 2024
17f417d
silly mistake
peterc-yuma Dec 17, 2024
9f43269
improve logging
peterc-yuma Dec 17, 2024
bd3f29a
Update env template
peterc-yuma Dec 18, 2024
afbb601
Deleted unused shell scripts
Dec 18, 2024
1ba4c9e
Move all python files into a top level package folder
Dec 18, 2024
8cd8235
Remove existing tests and add package version test
Dec 18, 2024
fa3c2c3
Adjust github actions to leverage poetry
Dec 18, 2024
04cec4d
Use poetry for dependency management
Dec 18, 2024
48c3228
Run pre-commit hooks
Dec 18, 2024
be016cf
Delete unused tests
Dec 18, 2024
c83ee56
Add pytest dependency
Dec 18, 2024
1389d07
Merge pull request #57 from foundryservices/235-adopt-poetry
peterc-yuma Dec 18, 2024
4e250b8
merged. needs testing
peterc-yuma Dec 18, 2024
d07beef
fix poetry error
peterc-yuma Dec 18, 2024
a475125
fix isort issue
peterc-yuma Dec 18, 2024
b7c9df2
fix test imports
peterc-yuma Dec 19, 2024
ff0bd02
fix yfinance error
peterc-yuma Dec 19, 2024
0ec8642
update config files to reflect new structure
peterc-yuma Dec 19, 2024
8e93c72
suggested changes
peterc-yuma Dec 19, 2024
349acc2
update reward.py
peterc-yuma Dec 19, 2024
877c34e
ensure correct yfinance version
peterc-yuma Dec 19, 2024
a2e21e3
Merge pull request #55 from foundryservices/260-require-data-input
Dec 19, 2024
327a84d
added Makefile
hayden-yuma Dec 19, 2024
eea6e92
missing \ in makefile
hayden-yuma Dec 19, 2024
cd0b143
Merge pull request #58 from foundryservices/add-makefile
peterc-yuma Dec 19, 2024
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
10 changes: 8 additions & 2 deletions .env.template
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
# Copy the contents on this file to a new file called .env
WANDB_API_KEY='REPLACE_WITH_WANDB_API_KEY'
MINER_HF_ACCESS_TOKEN='REPLACE_WITH_HUGGINGFACE_ACCESS_KEY'
HF_ACCESS_TOKEN='REPLACE_WITH_HUGGINGFACE_ACCESS_KEY'

HF_ACCESS_TOKEN = 'REPLACE_WITH_HUGGINGFACE_ACCESS_KEY'
WANDB_API_KEY = 'REPLACE_WITH_WANDB_API_KEY'
# Git credentials
GIT_TOKEN='REPLACE_WITH_GIT_TOKEN'
GIT_USERNAME='REPLACE_WITH_GIT_USERNAME'
GIT_NAME="REPLACE_WITH_GIT_NAME"
GIT_EMAIL="REPLACE_WITH_GIT_EMAIL"
67 changes: 42 additions & 25 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Cache and Load Build
name: Cache Build

on:
workflow_call:
Expand All @@ -17,7 +17,7 @@ jobs:
steps:

#------------------------------------------------
# Checkout repo and setup python
# check-out repo and set-up python
#------------------------------------------------
- name: Check out repository
uses: actions/checkout@v4
Expand All @@ -27,41 +27,58 @@ jobs:
python-version: '3.11'

#------------------------------------------------
# Load cached venv if cache exists
# ----- install & configure poetry -----
#------------------------------------------------
- name: Restore cached virtualenv
uses: actions/cache/restore@v4
id: restore-cache
- name: Load cached Poetry installation
id: cached-poetry
uses: actions/cache@v4
with:
path: ~/.local # the path depends on the OS
key: poetry-0 # increment to reset cache

- name: Install Poetry
if: steps.cached-poetry.outputs.cache-hit != 'true'
uses: snok/install-poetry@v1
with:
version: latest
virtualenvs-create: true
virtualenvs-in-project: true
virtualenvs-path: .venv
installer-parallel: true

# If cache was loaded, we must redo configuration
- name: Configure poetry
if: steps.cached-poetry.outputs.cache-hit == 'true'
run: |
poetry config virtualenvs.create true
poetry config virtualenvs.in-project true
poetry config virtualenvs.path .venv

#------------------------------------------------
# Load cached venv if exists
#------------------------------------------------
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v4
with:
key: venv-${{ runner.os }}-${{ steps.setup_python.outputs.python-version }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('dev_requirements.txt') }}
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}

#------------------------------------------------
# Install dependencies - if cache does not exist
# Install dependencies if cache does not exist
#------------------------------------------------
- name: Install dependencies
if: steps.restore-cache.outputs.cache-hit != 'true'
run: |
python -m venv .venv
source .venv/bin/activate
python -m pip install .[DEV]
echo "$VIRTUAL_ENV/bin" >> $GITHUB_PATH
echo "VIRTUAL_ENV=$VIRTUAL_ENV" >> $GITHUB_ENV
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root

#------------------------------------------------
# Save venv to cache - if not exists
# Install your root project
#------------------------------------------------
- name: Saved cached virtualenv
if: steps.restore-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
key: ${{ steps.restore-cache.outputs.cache-primary-key }}
path: .venv
- name: Install project
run: poetry install --no-interaction

#------------------------------------------------
# Run custom command(s) within venv
#------------------------------------------------
- name: Run commands
run: |
source .venv/bin/activate
${{ inputs.command }}
run: ${{ inputs.command }}
24 changes: 12 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Continuous Integration
name: CI

on:
pull_request:
push:
branches: [main, dev]
branches: [main, staging, dev]

jobs:
#----------------------------------------------
Expand All @@ -15,9 +15,10 @@ jobs:
with:
name: Cache
command: |
python -m pip list
python --version
echo "Build successful"
poetry run python -m pip list
poetry run python --version
poetry --version
poetry run echo "Build successful"

#----------------------------------------------
# Run Linters
Expand All @@ -28,29 +29,29 @@ jobs:
uses: ./.github/workflows/build.yml
with:
name: Black
command: python -m black --check .
command: poetry run python -m black --check .
lint-isort:
name: Linter
needs: build
uses: ./.github/workflows/build.yml
with:
name: Isort
command: python -m isort --check-only .
command: poetry run python -m isort --check-only .
lint-mypy:
name: Linter
needs: build
if: false # This condition ensures the job is never executed
uses: ./.github/workflows/build.yml
with:
name: Mypy
command: python -m mypy --verbose 0 .
command: poetry run python -m mypy --verbose 0 .
lint-flake8:
name: Linter
needs: build
uses: ./.github/workflows/build.yml
with:
name: Flake8
command: python -m flake8 .
command: poetry run python -m flake8 .

#----------------------------------------------
# Run Tests
Expand All @@ -63,9 +64,8 @@ jobs:
lint-mypy,
lint-flake8,
]
# `${{ always() }}` will run the tests regardless of linting success
if: false # This condition ensures the job is never executed
if: ${{ always() }} # will run the tests regardless of linting success
uses: ./.github/workflows/build.yml
with:
name: Unittests
command: pytest tests/
command: poetry run pytest tests/
57 changes: 57 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
################################################################################
# User Parameters #
################################################################################
coldkey = default
validator_hotkey = validator
miner_hotkey = miner
netuid = $(testnet_netuid)
network = $(testnet)


################################################################################
# Network Parameters #
################################################################################
finney = wss://entrypoint-finney.opentensor.ai:443
testnet = wss://test.finney.opentensor.ai:443
locanet = ws://127.0.0.1:9944

finney_netuid = 28
testnet_netuid = 93
localnet_netuid = 1
logging_level = info # options= ['info', 'debug', 'trace']


################################################################################
# Commands #
################################################################################
metagraph:
btcli subnet metagraph --netuid $(netuid) --subtensor.chain_endpoint $(network)

register:
{ \
read -p 'Wallet name?: ' wallet_name ;\
read -p 'Hotkey?: ' hotkey_name ;\
btcli subnet register --netuid $(netuid) --wallet.name "$$wallet_name" --wallet.hotkey "$$hotkey_name" --subtensor.chain_endpoint $(network) ;\
}

validator:
pm2 start python --name validator -- ./snp_oracle/neurons/validator.py \
--wallet.name $(coldkey) \
--wallet.hotkey $(validator_hotkey) \
--subtensor.chain_endpoint $(network) \
--axon.port 8091 \
--netuid $(netuid) \
--logging.level $(logging_level)

miner:
pm2 start python --name miner -- ./snp_oracle/neurons/miner.py \
--wallet.name $(coldkey) \
--wallet.hotkey $(miner_hotkey) \
--subtensor.chain_endpoint $(network) \
--axon.port 8092 \
--netuid $(netuid) \
--logging.level $(logging_level) \
--vpermit_tao_limit 2 \
--hf_repo_id foundryservices/bittensor-sn28-base-lstm \
--model mining_models/base_lstm_new.h5

9 changes: 0 additions & 9 deletions miner.config.js

This file was deleted.

Loading
Loading