add new system base in python for services
This commit is contained in:
parent
1ca5f4f70a
commit
8561196f0d
23
main.py
Normal file
23
main.py
Normal file
@ -0,0 +1,23 @@
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
|
||||
PYTHON_EXEC = 'python3.10'
|
||||
PATH = os.path.dirname(os.path.abspath(__file__))
|
||||
ROCM_VERSION = "6.1.2"
|
||||
|
||||
# Set up logging
|
||||
LEVEL = logging.DEBUG
|
||||
logger = logging.getLogger('ai-suite-rocm')
|
||||
if not logger.hasHandlers():
|
||||
handler_with_formatter = logging.StreamHandler(stream=sys.stdout)
|
||||
handler_with_formatter.setFormatter(logging.Formatter('[%(levelname)s] : %(message)s'))
|
||||
logger.addHandler(handler_with_formatter)
|
||||
logger.setLevel(LEVEL)
|
||||
|
||||
if __name__ == '__main__':
|
||||
logger.info("Starting AI Suite for ROCM")
|
||||
|
||||
from services import TextGeneration
|
||||
|
||||
test = TextGeneration().start()
|
2
services/__init__.py
Normal file
2
services/__init__.py
Normal file
@ -0,0 +1,2 @@
|
||||
from services.services import Stack
|
||||
from services.txtgen import TextGeneration
|
28
utils.py
Normal file
28
utils.py
Normal file
@ -0,0 +1,28 @@
|
||||
import json
|
||||
import urllib
|
||||
|
||||
from main import ROCM_VERSION, logger
|
||||
|
||||
|
||||
def get_prebuilts(repo_owner: str = "M4TH1EU", repo_name: str = "ai-suite-rocm-local",
|
||||
release_tag: str = f"prebuilt-whl-{ROCM_VERSION}") -> list:
|
||||
|
||||
api_url = f"https://api.github.com/repos/{repo_owner}/{repo_name}/releases/tags/{release_tag}"
|
||||
|
||||
try:
|
||||
with urllib.request.urlopen(api_url) as response:
|
||||
if response.status != 200:
|
||||
logger.error(f"Failed to fetch data: HTTP Status {response.status}")
|
||||
return []
|
||||
|
||||
release_data = json.load(response)
|
||||
|
||||
assets = release_data.get('assets', [])
|
||||
if not assets:
|
||||
logger.error("No assets found in release data")
|
||||
return []
|
||||
|
||||
return assets
|
||||
|
||||
except urllib.error.URLError as e:
|
||||
logger.error(f"Error fetching release data: {e}")
|
Loading…
Reference in New Issue
Block a user