macrocosm-os / prompting

SN1: An incentive mechanism for internet-scale conversational intelligence
https://bittensor.com
MIT License
70 stars 40 forks source link

AttributeError: 'ZephyrMiner' object has no attribute 'set_weights' #140

Closed ThomasBlock closed 6 months ago

ThomasBlock commented 6 months ago

Hi. i am new to bittensor and installed everything acording to documentation. The miner is crashing for me

ubuntu22
apt install docker.io -y
apt install docker-compose -y
docker-compose up -d mainnet-lite
ubuntu-drivers autoinstall

git clone https://github.com/opentensor/prompting.git
cd prompting
sudo apt-get install -y python3-pip
python3 -m pip install -r requirements.txt
python3 -m pip install -e .

python3 neurons/miners/zephyr/miner.py --netuid 1 --subtensor.network local --wallet.name default --wallet.hotkey default --logging.debug  --neuron.model_id HuggingFaceH4/zephyr-7b-beta
/usr/lib/python3/dist-packages/requests/__init__.py:87: RequestsDependencyWarning: urllib3 (2.2.1) or chardet (4.0.0) doesn't match a supported version!
  warnings.warn("urllib3 ({}) or chardet ({}) doesn't match a supported "
2024-03-05 21:19:33.191 |       INFO       | Logging path: /home/user/.bittensor/miners/default/default/netuid1/miner
2024-03-05 21:19:33.199 |       INFO       | 
wallet:
  name: default
  hotkey: default
  path: ~/.bittensor/wallets/
subtensor:
  network: local
  chain_endpoint: wss://entrypoint-finney.opentensor.ai:443
  _mock: false
logging:
  debug: true
  trace: false
  record_log: false
  logging_dir: ~/.bittensor/miners
axon:
  port: 8091
  ip: '[::]'
  external_port: null
  external_ip: null
  max_workers: 10
netuid: 1
neuron:
  device: cuda
  epoch_length: 100
  events_retention_size: 2 GB
  dont_save_events: false
  log_full: false
  name: miner
  model_id: HuggingFaceH4/zephyr-7b-beta
  load_quantized: false
  system_prompt: You are a helpful AI assistant. You answer questions, summarize documents,
    and debug code. You are always straight to the point and honest.
  max_tokens: 256
  temperature: 0.7
  top_k: 50
  top_p: 0.95
  stop_on_forward_exception: false
  full_path: /home/user/.bittensor/miners/default/default/netuid1/miner
mock: false
no_background_thread: true
wandb:
  'off': false
  offline: false
  notes: ''
  'on': false
  entity: opentensor-dev
  project_name: alpha-miners
blacklist:
  force_validator_permit: false
  allow_non_registered: false
config: null
strict: false
no_version_checking: false
no_prompt: false

2024-03-05 21:19:33.200 |       INFO       | Setting up bittensor objects. 
2024-03-05 21:19:33.203 |       INFO       | Connected to local network and ws://127.0.0.1:9944.
2024-03-05 21:19:40.938 |       INFO       | Wallet: wallet(default, default, ~/.bittensor/wallets/)
2024-03-05 21:19:40.938 |       INFO       | Subtensor: subtensor(local, ws://127.0.0.1:9944)
2024-03-05 21:19:40.938 |       INFO       | Metagraph: metagraph(netuid:1, n:1024, block:2503448, network:local)
2024-03-05 21:19:40.942 |       INFO       | Running neuron on subnet: 1 with uid 515 using network: ws://127.0.0.1:9944
2024-03-05 21:19:40.942 |     WARNING      | You are allowing non-validators to send requests to your miner. This is a security risk.
2024-03-05 21:19:41.049 |       INFO       | Attaching forward function to miner axon.
2024-03-05 21:19:41.052 |       INFO       | Axon created: Axon([::], 8091, 5Di4b9gGtjksRmsB4TCdkJphKwH23uBEdTcbduJZ6YYbiHmh, stopped, ['Synapse', 'PromptingSynapse'])
config.json: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 638/638 [00:00<00:00, 5.96MB/s]
model.safetensors.index.json: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████| 23.9k/23.9k [00:00<00:00, 136MB/s]
model-00001-of-00008.safetensors: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████| 1.89G/1.89G [00:07<00:00, 263MB/s]
model-00002-of-00008.safetensors: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████| 1.95G/1.95G [00:07<00:00, 246MB/s]
model-00003-of-00008.safetensors: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████| 1.98G/1.98G [00:08<00:00, 241MB/s]
model-00004-of-00008.safetensors: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████| 1.95G/1.95G [00:07<00:00, 256MB/s]
model-00005-of-00008.safetensors: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████| 1.98G/1.98G [00:07<00:00, 257MB/s]
model-00006-of-00008.safetensors: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████| 1.95G/1.95G [00:07<00:00, 257MB/s]
model-00007-of-00008.safetensors: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████| 1.98G/1.98G [00:07<00:00, 263MB/s]
model-00008-of-00008.safetensors: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████| 816M/816M [00:03<00:00, 265MB/s]
Downloading shards: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 8/8 [00:58<00:00,  7.34s/it]
Loading checkpoint shards: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████| 8/8 [00:18<00:00,  2.33s/it]
generation_config.json: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 111/111 [00:00<00:00, 373kB/s]
tokenizer_config.json: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1.43k/1.43k [00:00<00:00, 9.09MB/s]
tokenizer.model: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 493k/493k [00:00<00:00, 33.5MB/s]
tokenizer.json: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1.80M/1.80M [00:00<00:00, 4.98MB/s]
added_tokens.json: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 42.0/42.0 [00:00<00:00, 391kB/s]
special_tokens_map.json: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████| 168/168 [00:00<00:00, 1.43MB/s]
2024-03-05 21:21:06.089 |      DEBUG       | Starting miner in background thread.
2024-03-05 21:21:06.095 |      DEBUG       | Started                       
2024-03-05 21:21:06.098 |       INFO       | Miner running:: network: local | step: 0 | uid: 515 | trust: 0.375 | emission 0.001
2024-03-05 21:21:06.125 |       INFO       | resync_metagraph()            
2024-03-05 21:21:11.109 |       INFO       | Miner running:: network: local | step: 0 | uid: 515 | trust: 0.375 | emission 0.001
2024-03-05 21:21:16.128 |       INFO       | Miner running:: network: local | step: 0 | uid: 515 | trust: 0.375 | emission 0.001
2024-03-05 21:21:17.653 |       INFO       | Serving miner axon Axon([::], 8091, 5Di4b9gGtjksRmsB4TCdkJphKwH23uBEdTcbduJZ6YYbiHmh, stopped, ['Synapse', 'PromptingSynapse']) on network: wss://entrypoint-finney.opentensor.ai:443 with netuid: 1
2024-03-05 21:21:17.654 |      DEBUG       | Checking axon ...             
2024-03-05 21:21:17.675 |      DEBUG       | Serving axon with: AxonInfo(5Di4b9gGtjksRmsB4TCdkJphKwH23uBEdTcbduJZ6YYbiHmh,45.153.35.155:8091) -> local:1
2024-03-05 21:21:21.139 |       INFO       | Miner running:: network: local | step: 0 | uid: 515 | trust: 0.375 | emission 0.001
2024-03-05 21:21:26.145 |       INFO       | Miner running:: network: local | step: 0 | uid: 515 | trust: 0.375 | emission 0.001
2024-03-05 21:21:31.150 |       INFO       | Miner running:: network: local | step: 0 | uid: 515 | trust: 0.375 | emission 0.001
2024-03-05 21:21:36.156 |       INFO       | Miner running:: network: local | step: 0 | uid: 515 | trust: 0.375 | emission 0.001
2024-03-05 21:21:41.161 |       INFO       | Miner running:: network: local | step: 0 | uid: 515 | trust: 0.375 | emission 0.001
2024-03-05 21:21:46.166 |       INFO       | Miner running:: network: local | step: 0 | uid: 515 | trust: 0.375 | emission 0.001
2024-03-05 21:21:51.170 |       INFO       | Miner running:: network: local | step: 0 | uid: 515 | trust: 0.375 | emission 0.001
2024-03-05 21:21:56.175 |       INFO       | Miner running:: network: local | step: 0 | uid: 515 | trust: 0.375 | emission 0.001
2024-03-05 21:22:01.178 |       INFO       | Miner running:: network: local | step: 0 | uid: 515 | trust: 0.375 | emission 0.001
2024-03-05 21:22:06.182 |       INFO       | Miner running:: network: local | step: 0 | uid: 515 | trust: 0.375 | emission 0.001
2024-03-05 21:22:11.187 |       INFO       | Miner running:: network: local | step: 0 | uid: 515 | trust: 0.375 | emission 0.001
2024-03-05 21:22:13.642 |      DEBUG       | Axon served with: AxonInfo(5Di4b9gGtjksRmsB4TCdkJphKwH23uBEdTcbduJZ6YYbiHmh,45.153.35.155:8091) on local:1 
2024-03-05 21:22:13.646 |       INFO       | Miner starting at block: 2503461
2024-03-05 21:22:13.667 |       INFO       | resync_metagraph()            
2024-03-05 21:22:16.215 |       INFO       | Miner running:: network: local | step: 0 | uid: 515 | trust: 0.375 | emission 0.001
2024-03-05 21:22:21.231 |       INFO       | Miner running:: network: local | step: 0 | uid: 515 | trust: 0.375 | emission 0.001
2024-03-05 21:22:22.368 |       INFO       | resync_metagraph()            
2024-03-05 21:22:26.421 |       INFO       | Miner running:: network: local | step: 1 | uid: 515 | trust: 0.375 | emission 0.001
2024-03-05 21:22:31.468 |       INFO       | Miner running:: network: local | step: 1 | uid: 515 | trust: 0.375 | emission 0.001
2024-03-05 21:22:33.152 |      ERROR       | Error during mining           'ZephyrMiner' object has no attribute 'set_weights'
Traceback (most recent call last):
  File "/home/user/prompting/prompting/base/miner.py", line 123, in run
    self.sync()
  File "/home/user/prompting/prompting/base/neuron.py", line 123, in sync
    self.set_weights()
AttributeError: 'ZephyrMiner' object has no attribute 'set_weights'
2024-03-05 21:22:33.155 |      DEBUG       | None                          
2024-03-05 21:22:36.474 |     WARNING      | Ending miner...               
2024-03-05 21:22:36.476 |      DEBUG       | Stopping miner in background thread.
2024-03-05 21:22:36.476 |      DEBUG       | Stopped                  
ThomasBlock commented 6 months ago

--neuron.load_quantized True seems to help. ( although i have a A5000 with 24 GB VRAM )

2024-03-05 21:33:26.058 |       INFO       | resync_metagraph()            
2024-03-05 21:33:27.821 |       INFO       | Miner running:: network: local | step: 1 | uid: 515 | trust: 0.000 | emission 0.000
2024-03-05 21:33:29.327 |      DEBUG       | axon     | <-- | 2034 B | PromptingSynapse | 5Dd8gaRNdhm1YP7G1hcB1N842ecAUQmbLjCRLqH5ycaTGrWv | 89.187.159.10:48090 | 200 | Success 
2024-03-05 21:33:29.357 |      DEBUG       | 📧 Message received, forwarding synapse: required_hash_fields=['messages'] roles=['user'] messages=['Generate response to the question/instruction based on a piece of given material"\n\noriginal question/instruction: how has science fiction in chile evolved over time, and which contemporary authors are contributing significantly to this literary subgenre? Please provide specific examples of their works. Given material: this is a roleplaying game where you are impersonating an annoyed human user with a specific persona. As a human, you are using ai assistant to get help on answering a question related to chilean science fiction (s1 spanish-language sources (es)) in a indifferent tone. You don\'t need to greet the assistant or be polite, unless this is part of your persona. The spelling and grammar of your messages should also reflect your persona. Roleplaying persona: i don\'t care about pleasantries, just give me the information i need. You better not waste my time with irrelevant details or flowery language. Stick to the facts and keep it concise. I have better things to do than read a novel. Assistant response: science fiction in chile has undergone a significant transformation over the years, evolving from a niche genre to a more mainstream phenomenon.'] completion=''
2024-03-05 21:33:29.358 |      DEBUG       | 💬 Querying zephyr: Generate response to the question/instruction based on a piece of given material"

original question/instruction: how has science fiction in chile evolved over time, and which contemporary authors are contributing significantly to this literary subgenre? Please provide specific examples of their works. Given material: this is a roleplaying game where you are impersonating an annoyed human user with a specific persona. As a human, you are using ai assistant to get help on answering a question related to chilean science fiction (s1 spanish-language sources (es)) in a indifferent tone. You don't need to greet the assistant or be polite, unless this is part of your persona. The spelling and grammar of your messages should also reflect your persona. Roleplaying persona: i don't care about pleasantries, just give me the information i need. You better not waste my time with irrelevant details or flowery language. Stick to the facts and keep it concise. I have better things to do than read a novel. Assistant response: science fiction in chile has undergone a significant transformation over the years, evolving from a niche genre to a more mainstream phenomenon.
/home/user/.local/lib/python3.10/site-packages/transformers/generation/utils.py:1518: UserWarning: You have modified the pretrained model configuration to control generation. This is a deprecated strategy to control generation and will be removed soon, in a future version. Please use and modify the model generation configuration (see https://huggingface.co/docs/transformers/generation_strategies#default-text-generation-configuration )
  warnings.warn(
2024-03-05 21:33:32.855 |       INFO       | Miner running:: network: local | step: 1 | uid: 515 | trust: 0.000 | emission 0.000
2024-03-05 21:33:35.689 |       INFO       | resync_metagraph()            
2024-03-05 21:33:37.878 |       INFO       | Miner running:: network: local | step: 2 | uid: 515 | trust: 0.000 | emission 0.000
2024-03-05 21:33:43.070 |       INFO       | Miner running:: network: local | step: 2 | uid: 515 | trust: 0.000 | emission 0.000
ThomasBlock commented 6 months ago

after rebooting, i could run without quantisation..

mccrindlebrian commented 6 months ago

@ThomasBlock Thanks for raising this issue! We are aware of this and have a solution waiting to be merged into main. Check https://github.com/opentensor/prompting/pull/141