p-ferreira commited on
Commit
165523e
·
unverified ·
2 Parent(s): 49df8e1 5c77ba3

Merge pull request #6 from macrocosm-os/features/small-improvements

Browse files
requirements.txt CHANGED
@@ -1,4 +1,4 @@
1
- git+https://github.com/opentensor/prompting.git@features/move-validator-into-prompting
2
  aiohttp
3
  deprecated
4
  aiohttp_apispec>=2.2.3
 
1
+ git+https://github.com/macrocosm-os/prompting.git
2
  aiohttp
3
  deprecated
4
  aiohttp_apispec>=2.2.3
validators/sn1_validator_wrapper.py CHANGED
@@ -36,7 +36,7 @@ class S1ValidatorAPI(ValidatorAPI):
36
  axons = [self.validator.metagraph.axons[uid] for uid in uids]
37
 
38
  # Make calls to the network with the prompt.
39
- bt.logging.info(f"Calling dendrite")
40
 
41
  streams_responses = await self.validator.dendrite(
42
  axons=axons,
 
36
  axons = [self.validator.metagraph.axons[uid] for uid in uids]
37
 
38
  # Make calls to the network with the prompt.
39
+ bt.logging.info(f"Sampling dendrite by {params.sampling_mode} with roles {params.roles} and messages {params.messages}")
40
 
41
  streams_responses = await self.validator.dendrite(
42
  axons=axons,
validators/streamer.py CHANGED
@@ -63,7 +63,11 @@ class AsyncResponseDataStreamer:
63
  # Writes the new response state to the response
64
  await response.write(new_response_state.encode('utf-8'))
65
 
66
- if chunk is not None and isinstance(chunk, StreamPromptingSynapse):
 
 
 
 
67
  self.finish_reason = "completed"
68
  self.sequence_number += 1
69
  # Assuming the last chunk holds the last value yielded which should be a synapse with the completion filled
 
63
  # Writes the new response state to the response
64
  await response.write(new_response_state.encode('utf-8'))
65
 
66
+ if chunk is not None and isinstance(chunk, StreamPromptingSynapse):
67
+ if len(self.accumulated_chunks) == 0:
68
+ self.accumulated_chunks.append(chunk.completion)
69
+ self.accumulated_chunks_timings.append(time.time() - start_time)
70
+
71
  self.finish_reason = "completed"
72
  self.sequence_number += 1
73
  # Assuming the last chunk holds the last value yielded which should be a synapse with the completion filled