Skip to content

Commit f30307d

Browse files
ifrit98steffencruz
andauthored
Features/modular (opentensor#26)
* WIP refactor for improved workflow abstracitons * Add WIP test and debug validator forward * get miner working * (almost) get validator working * validator working * black formatter * docstrings * tests (WIP) * Remove rewards and unncessary imports. Update forward docstrings * Add axon. Minor reordering and some docstring cleanup * Add miner todo for saving state * Black * Restructure config to separate miner and validator specific args * Black * Change starting scores from ones to zeros * Features/more modular (opentensor#27) * Create BaseNeuron class, which takes care of common operations between miner and validator neurons. Also move everything in sync.py to the respective neuron classes and delete * And removes pylint swiftly afterwards * Features/cleanup modular (opentensor#31) * Cleanup docs and remove spec version so that these files do not need to be modified by developers * Further docstring improvements and set spec version as an attribute to be used when setting weights * Add license and some docstring improvements * Update README to contain correct TODO files, add note to developer to rename template directory and enforce consistent TODO comments throughout files * Black * Fix imports and logging. Move blacklist and priority abstractmethods to BaseMinerNeuron so that validators do not need to define them; * pylint on major errors, black 79 line limit * run black with 79 line length * update neuron child class names * add spec version as a member of BaseNeuron * don't set_weights on init and add load_state() * add proper enter/exit, don't delete axon, save/load state for vali * handle spec version in base class * set epoch length default 0->5, check if should exit in validator run * don't save/load block, load state in validator init as hint * black * Change epoch length to 100 --------- Co-authored-by: ifrit98 <[email protected]> --------- Co-authored-by: Steffen Cruz <[email protected]>
1 parent 240aee7 commit f30307d

21 files changed

+1460
-355
lines changed

.circleci/config.yml

+28-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,31 @@ jobs:
4040
name: Black format check
4141
command: |
4242
. env/bin/activate
43-
python -m black --exclude '(env|venv|.eggs)' --check .
43+
black --line-length 79 --exclude '(env|venv|.eggs)' --check .
44+
45+
pylint:
46+
resource_class: small
47+
parameters:
48+
python-version:
49+
type: string
50+
docker:
51+
- image: cimg/python:<< parameters.python-version >>
52+
53+
steps:
54+
- checkout
55+
56+
- run:
57+
name: Install Pylint
58+
command: |
59+
python -m venv env/
60+
. env/bin/activate
61+
pip install pylint
62+
63+
- run:
64+
name: Pylint check
65+
command: |
66+
. env/bin/activate
67+
pylint --fail-on=W,E,F --exit-zero ./
4468
4569
check_compatibility:
4670
parameters:
@@ -131,11 +155,13 @@ workflows:
131155
- check_compatibility:
132156
python_version: "3.11"
133157
name: check-compatibility-3.11
134-
158+
135159
pr-requirements:
136160
jobs:
137161
- black:
138162
python-version: "3.8.12"
163+
- pylint:
164+
python-version: "3.8.12"
139165
- build:
140166
matrix:
141167
parameters:

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -158,3 +158,5 @@ cython_debug/
158158
# and can be added to the global gitignore or merged into this file. For a more nuclear
159159
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
160160
#.idea/
161+
162+
testing/

README.md

+13-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ This template contains all the required installation instructions, scripts, and
2828
- Building Bittensor subnets.
2929
- Creating custom incentive mechanisms and running these mechanisms on the subnets.
3030

31+
In order to simplify the building of subnets, this template abstracts away the complexity of the underlying blockchain and other boilerplate code. While the default behavior of the template is sufficient for a simple subnet, you should customize the template in order to meet your specific requirements.
3132
---
3233

3334
## Introduction
@@ -81,7 +82,18 @@ As described in [Quickstarter template](#quickstarter-template) section above, w
8182
- `template/protocol.py`: Contains the definition of the wire-protocol used by miners and validators.
8283
- `neurons/miner.py`: Script that defines the miner's behavior, i.e., how the miner responds to requests from validators.
8384
- `neurons/validator.py`: This script defines the validator's behavior, i.e., how the validator requests information from the miners and determines the scores.
84-
85+
- `template/forward.py`: Contains the definition of the validator's forward pass.
86+
- `template/reward.py`: Contains the definition of how validators reward miner responses.
87+
88+
In addition to the above files, you should also update the following files:
89+
- `README.md`: This file contains the documentation for your project. Update this file to reflect your project's documentation.
90+
- `CONTRIBUTING.md`: This file contains the instructions for contributing to your project. Update this file to reflect your project's contribution guidelines.
91+
- `template/__init__.py`: This file contains the version of your project.
92+
- `setup.py`: This file contains the metadata about your project. Update this file to reflect your project's metadata.
93+
- `docs/`: This directory contains the documentation for your project. Update this directory to reflect your project's documentation.
94+
95+
__Note__
96+
The `template` directory should also be renamed to your project name.
8597
---
8698

8799
## License

contrib/CONTRIBUTING.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ The following is a set of guidelines for contributing to the Bittensor ecosystem
1616

1717

1818
## How Can I Contribute?
19-
TODO[owner]: Define your desired contribution procedure.
19+
TODO(developer): Define your desired contribution procedure.
2020

2121
## Communication Channels
22-
TODO[owner]: Place your communication channels here
22+
TODO(developer): Place your communication channels here
2323

2424
> Please follow the Bittensor Subnet [style guide](./STYLE.md) regardless of your contribution type.
2525
@@ -99,7 +99,7 @@ After you submit a pull request, it will be reviewed by the maintainers. They ma
9999
> Note: Be sure to merge the latest from "upstream" before making a pull request:
100100
101101
```bash
102-
git remote add upstream https://github.com/opentensor/bittensor.git # TODO[owner]: replace with your repo URL
102+
git remote add upstream https://github.com/opentensor/bittensor.git # TODO(developer): replace with your repo URL
103103
git fetch upstream
104104
git merge upstream/<your-branch-name>
105105
git push origin <your-branch-name>

docs/running_on_mainnet.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ After installing `bittensor`, proceed as below:
2929

3030
```bash
3131
# In your project directory
32-
git clone https://github.com/opentensor/bittensor-subnet-template.git # TODO[owner]: Replace this with your custom repo URL
32+
git clone https://github.com/opentensor/bittensor-subnet-template.git # TODO(developer): Replace this with your custom repo URL
3333
cd bittensor-subnet-template # Enter your subnet template repo directory
3434
python -m pip install -e . # Install your subnet template package
3535
```

neurons/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)