generated from opentensor/bittensor-subnet-template
-
Notifications
You must be signed in to change notification settings - Fork 53
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
Features/streaming #103
Merged
Merged
Features/streaming #103
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
p-ferreira
reviewed
Mar 11, 2024
p-ferreira
reviewed
Mar 11, 2024
steffencruz
reviewed
Mar 12, 2024
Still needs a README |
p-ferreira
reviewed
Mar 12, 2024
steffencruz
approved these changes
Mar 12, 2024
p-ferreira
approved these changes
Mar 12, 2024
Co-authored-by: Steffen Cruz <[email protected]>
Co-authored-by: Steffen Cruz <[email protected]>
steffencruz
reviewed
Mar 12, 2024
Co-authored-by: Steffen Cruz <[email protected]>
…into features/streaming
schampoux
approved these changes
Mar 12, 2024
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR provides functionality for validator and miner streaming.
Key Points
docs/stream_tutorial
to clean up repoBaseMinerNeuron
, into a newBaseStreamMinerNeuron
that changes the requirements for miner forward methodhandle_response
function, which handles the async calls to the appropriate miners and acquires their completedStreamPromptingSynapses
'Queue
handled by aCustomTextStreamerIterator
. Langchain miners are thrown onto a new thread where generations are done in batches ofconfig.neuron.streaming_batch_size
. When the generation is done, the threads are closed, and theQueue
is dumped. In cases where timeout is reached, theQueue
will not be empty, and on subsequent calls to the miner they will reply with tokens generated from the previous uncompleted request. This is undesirable, so we forcibly clear thisQueue
.load_pipeline
can now return streamer classes like the one mentioned in point 4prompting.protocol
holds theStreamPromptingSynapse
and is used to decode streamed chunks.client.py
to ping a miner on testnet without running a validator.MockDendrite
andMockStreamMiner
are included in the mock.py file for testing purposes.Block Diagram
This is a rough idea of what is happening during streaming for the most complicated case (langchain)

Limitations
get_openai_callback
from langchain doesn't seem to integrate easily with the async calls that occur in the _forward method. This callback is used to track overall costs and openai information. I was unable to get this to work within a satisfactory amount of time, so therefore openai based miners do not use the callback anymore. This is a direction for future work.