generated from opentensor/bittensor-subnet-template
-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #495 from macrocosm-os/staging
v2.15.0
- Loading branch information
Showing
90 changed files
with
1,946 additions
and
2,121 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
API_PORT = "8005" | ||
API_HOST = "0.0.0.0" | ||
# SCORING_KEY = "YOUR_SCORING_API_KEY_GOES_HERE" |
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,15 +7,14 @@ pip install poetry | |
poetry config virtualenvs.in-project true | ||
|
||
# Install the project dependencies | ||
poetry install | ||
poetry install --extras "validator" | ||
|
||
git clone [email protected]:casper-hansen/AutoAWQ.git && cd AutoAWQ && poetry run pip install -e . && cd .. | ||
# Build AutoAWQ==0.2.7.post3 from source | ||
git clone https://github.com/casper-hansen/AutoAWQ.git | ||
cd AutoAWQ && poetry run pip install -e . && cd .. | ||
|
||
poetry run pip install flash-attn --no-build-isolation | ||
|
||
# Updating the package list and installing jq and npm | ||
apt update && apt install -y jq npm | ||
|
||
# Check if jq is installed and install it if not | ||
if ! command -v jq &> /dev/null | ||
then | ||
|
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import openai | ||
from httpx import Timeout | ||
|
||
from prompting import settings | ||
|
||
settings.settings = settings.Settings.load(mode="validator") | ||
settings = settings.settings | ||
|
||
from shared.epistula import create_header_hook | ||
|
||
|
||
async def main(): | ||
payload = { | ||
"seed": "42", | ||
"sampling_parameters": settings.SAMPLING_PARAMS, | ||
"task": "InferenceTask", | ||
"model": "Dummy_Model", | ||
"messages": [ | ||
{"role": "user", "content": "#Bittensor #ToTheMoon"}, | ||
], | ||
} | ||
|
||
uid = 732 | ||
try: | ||
axon_info = settings.METAGRAPH.axons[uid] | ||
miner = openai.AsyncOpenAI( | ||
base_url=f"http://{axon_info.ip}:{axon_info.port}/v1", | ||
api_key="Apex", | ||
max_retries=0, | ||
timeout=Timeout(settings.NEURON_TIMEOUT, connect=5, read=10), | ||
http_client=openai.DefaultAsyncHttpxClient( | ||
event_hooks={"request": [create_header_hook(settings.WALLET.hotkey, axon_info.hotkey)]} | ||
), | ||
) | ||
chat = await miner.chat.completions.create( | ||
messages=payload["messages"], | ||
model=payload["model"], | ||
stream=True, | ||
extra_body={k: v for k, v in payload.items() if k not in ["messages", "model"]}, | ||
) | ||
|
||
async for chunk in chat: | ||
if chunk.choices[0].delta and chunk.choices[0].delta.content: | ||
print(chunk.choices[0].delta.content) | ||
except Exception as e: | ||
print("something went wrong", e) | ||
return | ||
|
||
|
||
if __name__ == "__main__": | ||
import asyncio | ||
|
||
asyncio.run(main()) |
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
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
Oops, something went wrong.