def config(cls): """ Get config from the argument parser Return: bittensor.config object """ parser = argparse.ArgumentParser() logging.add_args(parser) return bittensor.config(parser)
def config(cls) -> 'bittensor.Config': """ Get config from the argument parser Return: bittensor.config object """ parser = argparse.ArgumentParser() prioritythreadpool.add_args( parser ) return bittensor.config( parser )
def config(cls) -> 'bittensor.Config': """ Get config from teh argument parser Return: bittensor.config object """ parser = argparse.ArgumentParser() metagraph.add_args(parser) return bittensor.config(parser)
def config(cls) -> 'bittensor.Config': """ Get config from the argument parser Return: bittensor.config object """ parser = argparse.ArgumentParser() dataset.add_args( parser ) return bittensor.config( parser )
def config (): parser = argparse.ArgumentParser() parser.add_argument('--config', type=str, help='If set, defaults are overridden by passed file.') parser.add_argument('--neuron.learning_rate', type=float, help='Training initial learning rate.', default=0.01) parser.add_argument('--neuron.momentum', type=float, help='optimizer momentum.', default=0.8) parser.add_argument('--neuron.clip_gradients', type=float, help='Implement gradient clipping to avoid exploding loss on smaller architectures.', default=1.0) parser.add_argument('--neuron.device', type=str, help='miner default training device cpu/cuda', default=("cuda" if torch.cuda.is_available() else "cpu")) parser.add_argument('--neuron.model_name', type=str, help='pretrained model from hugging face',default='gpt2') parser.add_argument('--neuron.pretrained', action='store_false', help='if the model should be pretrained',default=True) parser.add_argument('--neuron.padding', action='store_false', help='To pad out final dimensions',default=True) parser.add_argument('--neuron.interpolate', action='store_false', help='To interpolate between sentence length',default=True) parser.add_argument('--neuron.inter_degree', type=str, help='Interpolate algorithm (nearest | linear | bilinear | bicubic | trilinear | area)', default='nearest') parser.add_argument('--neuron.name', type=str, help='Trials for this miner go in miner.root / (wallet_cold - wallet_hot) / miner.name ', default='advanced_server') parser.add_argument('--neuron.checking', action='store_false', help='To check if server settings are correct',default=True) parser.add_argument('--neuron.no_restart', action='store_true', help='if the model should restart', default=False) parser.add_argument('--neuron.blacklist.stake.forward', type=float, help='Amount of stake (tao) in order not to get blacklisted for forward requests', default=10) parser.add_argument('--neuron.blacklist.stake.backward', type=float, help='Amount of stake (tao) in order not to get blacklisted for backward requests', default=100) parser.add_argument('--neuron.blacklist_allow_non_registered', action='store_true', help='''If true, black lists non-registered peers''', default=True) parser.add_argument('--neuron.metagraph_sync', type=float, help='how often to sync the metagraph', default=100000) parser.add_argument('--neuron.blocks_per_set_weights', type=float, help='how often to sync set weights', default=100) parser.add_argument('--neuron.blocks_per_epoch', type=int, help='Blocks per epoch', default=2) parser.add_argument('--neuron.blacklist.time', type=int, help='how often a peer can query you (seconds) ', default=2) bittensor.wallet.add_args( parser ) bittensor.axon.add_args( parser ) bittensor.subtensor.add_args( parser ) bittensor.logging.add_args( parser ) bittensor.wandb.add_args(parser) bittensor.prioritythreadpool.add_args( parser ) bittensor.dataset.add_args( parser ) return bittensor.config( parser )
def full(): """ From the parser, add arguments to multiple bittensor sub-modules """ parser = ArgumentParser() bittensor.wallet.add_args(parser) bittensor.subtensor.add_args(parser) bittensor.axon.add_args(parser) bittensor.dendrite.add_args(parser) bittensor.metagraph.add_args(parser) bittensor.dataset.add_args(parser) return bittensor.config(parser)
def config(): parser = argparse.ArgumentParser() parser.add_argument( '--config', type=str, help='If set, defaults are overridden by passed file.') parser.add_argument( '--neuron.name', type=str, help= 'Trials for this miner go in miner.root / (wallet_cold - wallet_hot) / miner.name ', default='sgmoe_validator') parser.add_argument('--neuron.no_restart', action='store_true', help='resume previous trial.', default=False) parser.add_argument( '--neuron.topk', type=int, help='the number of peers queried during each remote forward call', default=20) parser.add_argument('--neuron.learning_rate', type=float, help='Training initial learning rate.', default=1e-4) parser.add_argument('--neuron.learning_rate_chain', type=float, help='Training initial learning rate.', default=1) parser.add_argument('--neuron.momentum', type=float, help='optimizer momentum.', default=0.8) parser.add_argument('--neuron.blocks_per_epoch', type=int, help='Blocks per epoch', default=100) parser.add_argument( '--neuron.n_topk_peer_weights', type=int, help='Maximum number of weights to submit to chain', default=500) parser.add_argument( '--neuron.device', type=str, help='miner default training device cpu/cuda', default=("cuda" if torch.cuda.is_available() else "cpu")) parser.add_argument( '--neuron.clip_gradients', type=float, help= 'Implement gradient clipping to avoid exploding loss on smaller architectures.', default=1.0) parser.add_argument('--neuron.metagraph_sync', type=float, help='how often to sync the metagraph', default=5000) parser.add_argument( '--nucleus.nhid', type=int, help= 'the dimension of the feedforward network model in nn.TransformerEncoder', default=200) parser.add_argument( '--nucleus.nhead', type=int, help='the number of heads in the multiheadattention models', default=2) parser.add_argument( '--nucleus.nlayers', type=int, help= 'the number of nn.TransformerEncoderLayer in nn.TransformerEncoder', default=2) parser.add_argument('--nucleus.dropout', type=float, help='the dropout value', default=0.2) parser.add_argument('--nucleus.importance', type=float, help='hyperparameter for the importance loss', default=0.001) bittensor.wallet.add_args(parser) bittensor.dendrite.add_args(parser) bittensor.subtensor.add_args(parser) bittensor.logging.add_args(parser) bittensor.dataset.add_args(parser) bittensor.wandb.add_args(parser) return bittensor.config(parser)
def config() -> 'bittensor.config': """ From the argument parser, add config to bittensor.executor and local config Return: bittensor.config object """ parser = argparse.ArgumentParser(description="Bittensor cli", usage="btcli <command> <command args>", add_help=True) cmd_parsers = parser.add_subparsers(dest='command') overview_parser = cmd_parsers.add_parser( 'overview', help='''Show account overview.''' ) overview_parser.add_argument( '--no_prompt', dest='no_prompt', action='store_true', help='''Set protect the generated bittensor key with a password.''', default=False, ) bittensor.wallet.add_args( overview_parser ) bittensor.subtensor.add_args( overview_parser ) run_parser = cmd_parsers.add_parser( 'run', help='''Run the miner.''' ) run_parser.add_argument( '--no_prompt', dest='no_prompt', action='store_true', help='''Set protect the generated bittensor key with a password.''', default=False, ) run_parser.add_argument( '--model', type=str, choices= list(bittensor.neurons.__text_neurons__.keys()), default='template_miner', help='''Miners available through bittensor.neurons''' ) bittensor.subtensor.add_args( run_parser ) bittensor.wallet.add_args( run_parser ) metagraph_parser = cmd_parsers.add_parser( 'metagraph', help='''Metagraph commands''' ) metagraph_parser.add_argument( '--no_prompt', dest='no_prompt', action='store_true', help='''Set protect the generated bittensor key with a password.''', default=False, ) bittensor.subtensor.add_args( metagraph_parser ) inspect_parser = cmd_parsers.add_parser( 'inspect', help='''Inspect a wallet (cold, hot) pair''' ) inspect_parser.add_argument( '--no_prompt', dest='no_prompt', action='store_true', help='''Set protect the generated bittensor key with a password.''', default=False, ) bittensor.wallet.add_args( inspect_parser ) bittensor.subtensor.add_args( inspect_parser ) weights_parser = cmd_parsers.add_parser( 'weights', help='''Weights commands''' ) weights_parser.add_argument( '--no_prompt', dest='no_prompt', action='store_true', help='''Set protect the generated bittensor key with a password.''', default=False, ) bittensor.wallet.add_args( weights_parser ) bittensor.subtensor.add_args( weights_parser ) set_weights_parser = cmd_parsers.add_parser( 'set_weights', help='''Weights commands''' ) set_weights_parser.add_argument( '--no_prompt', dest='no_prompt', action='store_true', help='''Set protect the generated bittensor key with a password.''', default=False, ) parser.add_argument ("--uids", type=int, required=False, nargs='*', action='store', help="Uids to set.") parser.add_argument ("--weights", type=float, required=False, nargs='*', action='store', help="Weights to set.") bittensor.wallet.add_args( set_weights_parser ) bittensor.subtensor.add_args( set_weights_parser ) list_parser = cmd_parsers.add_parser( 'list', help='''List wallets''' ) list_parser.add_argument( '--no_prompt', dest='no_prompt', action='store_true', help='''Set protect the generated bittensor key with a password.''', default=False, ) bittensor.wallet.add_args( list_parser ) transfer_parser = cmd_parsers.add_parser( 'transfer', help='''Transfer Tao between accounts.''' ) register_parser = cmd_parsers.add_parser( 'register', help='''Register a wallet to a network.''' ) unstake_parser = cmd_parsers.add_parser( 'unstake', help='''Unstake from hotkey accounts.''' ) stake_parser = cmd_parsers.add_parser( 'stake', help='''Stake to your hotkey accounts.''' ) regen_coldkey_parser = cmd_parsers.add_parser( 'regen_coldkey', help='''Regenerates a coldkey from a passed mnemonic''' ) regen_hotkey_parser = cmd_parsers.add_parser( 'regen_hotkey', help='''Regenerates a hotkey from a passed mnemonic''' ) new_coldkey_parser = cmd_parsers.add_parser( 'new_coldkey', help='''Creates a new hotkey (for running a miner) under the specified path. ''' ) new_hotkey_parser = cmd_parsers.add_parser( 'new_hotkey', help='''Creates a new coldkey (for containing balance) under the specified path. ''' ) # Fill arguments for the regen coldkey command. regen_coldkey_parser.add_argument( "--mnemonic", required=False, nargs="+", help='Mnemonic used to regen your key i.e. horse cart dog ...' ) regen_coldkey_parser.add_argument( '--use_password', dest='use_password', action='store_true', help='''Set protect the generated bittensor key with a password.''', default=True, ) regen_coldkey_parser.add_argument( '--no_password', dest='use_password', action='store_false', help='''Set off protects the generated bittensor key with a password.''', ) regen_coldkey_parser.add_argument( '--no_prompt', dest='no_prompt', action='store_true', help='''Set protect the generated bittensor key with a password.''', default=False, ) bittensor.wallet.add_args( regen_coldkey_parser ) # Fill arguments for the regen hotkey command. regen_hotkey_parser.add_argument( "--mnemonic", required=False, nargs="+", help='Mnemonic used to regen your key i.e. horse cart dog ...' ) regen_hotkey_parser.add_argument( '--use_password', dest='use_password', action='store_true', help='''Set protect the generated bittensor key with a password.''', default=False ) regen_hotkey_parser.add_argument( '--no_password', dest='use_password', action='store_false', help='''Set off protects the generated bittensor key with a password.''' ) regen_hotkey_parser.add_argument( '--no_prompt', dest='no_prompt', action='store_true', help='''Set protect the generated bittensor key with a password.''', default=False, ) bittensor.wallet.add_args( regen_hotkey_parser ) # Fill arguments for the new coldkey command. new_coldkey_parser.add_argument( '--n_words', type=int, choices=[12,15,18,21,24], default=12, help='''The number of words representing the mnemonic. i.e. horse cart dog ... x 24''' ) new_coldkey_parser.add_argument( '--use_password', dest='use_password', action='store_true', help='''Set protect the generated bittensor key with a password.''', default=True, ) new_coldkey_parser.add_argument( '--no_password', dest='use_password', action='store_false', help='''Set off protects the generated bittensor key with a password.''' ) new_coldkey_parser.add_argument( '--no_prompt', dest='no_prompt', action='store_true', help='''Set protect the generated bittensor key with a password.''', default=False, ) bittensor.wallet.add_args( new_coldkey_parser ) # Fill arguments for the new hotkey command. new_hotkey_parser.add_argument( '--n_words', type=int, choices=[12,15,18,21,24], default=12, help='''The number of words representing the mnemonic. i.e. horse cart dog ... x 24''' ) new_hotkey_parser.add_argument( '--use_password', dest='use_password', action='store_true', help='''Set protect the generated bittensor key with a password.''', default=False ) new_hotkey_parser.add_argument( '--no_password', dest='use_password', action='store_false', help='''Set off protects the generated bittensor key with a password.''' ) new_hotkey_parser.add_argument( '--no_prompt', dest='no_prompt', action='store_true', help='''Set protect the generated bittensor key with a password.''', default=False, ) bittensor.wallet.add_args( new_hotkey_parser ) # Fill arguments for unstake command. unstake_parser.add_argument( '--all', dest="unstake_all", action='store_true', default=False, ) unstake_parser.add_argument( '--amount', dest="amount", type=float, required=False ) unstake_parser.add_argument( '--no_prompt', dest='no_prompt', action='store_true', help='''Set protect the generated bittensor key with a password.''', default=False, ) bittensor.wallet.add_args( unstake_parser ) bittensor.subtensor.add_args( unstake_parser ) # Fill arguments for stake command. stake_parser.add_argument( '--all', dest="stake_all", action='store_true' ) stake_parser.add_argument( '--uid', dest="uid", type=int, required=False ) stake_parser.add_argument( '--amount', dest="amount", type=float, required=False ) stake_parser.add_argument( '--no_prompt', dest='no_prompt', action='store_true', help='''Set protect the generated bittensor key with a password.''', default=False, ) bittensor.wallet.add_args( stake_parser ) bittensor.subtensor.add_args( stake_parser ) # Fill arguments for transfer transfer_parser.add_argument( '--dest', dest="dest", type=str, required=False ) transfer_parser.add_argument( '--amount', dest="amount", type=float, required=False ) transfer_parser.add_argument( '--no_prompt', dest='no_prompt', action='store_true', help='''Set protect the generated bittensor key with a password.''', default=False, ) bittensor.wallet.add_args( transfer_parser ) bittensor.subtensor.add_args( transfer_parser ) # Fill arguments for transfer register_parser.add_argument( '--no_prompt', dest='no_prompt', action='store_true', help='''Set protect the generated bittensor key with a password.''', default=False, ) bittensor.wallet.add_args( register_parser ) bittensor.subtensor.add_args( register_parser ) # Fill run parser. run_parser.add_argument( '--path', dest="path", default=os.path.expanduser('miners/text/template_miner.py'), type=str, required=False ) # Hack to print formatted help if len(sys.argv) == 1: parser.print_help() sys.exit(0) return bittensor.config( parser )
def config(cls) -> 'bittensor.Config': """ Get config from the argument parser """ parser = argparse.ArgumentParser() dendrite.add_args(parser) return bittensor.config(parser)
def config() -> 'bittensor.Config': parser = argparse.ArgumentParser() subtensor.add_args(parser) return bittensor.config(parser)