File size: 1,640 Bytes
bd0f899
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a7e0433
 
c690ade
bd0f899
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import time

import schedule
from loguru import logger
from replicate import Client

from kitt.skills.common import config

replicate = Client(api_token=config.REPLICATE_API_KEY)


def run_replicate_model():
    logger.info("Running the replicate model.")
    output = replicate.run(
        "sasan-j/hermes-2-pro-llama-3-8b:28b1dc16f47d9df68d9839418282315d5e78d9e2ab3fa6ff15728c76ae71a6d6",
        input={
            "top_k": 50,
            "top_p": 0.9,
            "prompt": "Hello, who are you?",
            "temperature": 0.6,
            "system_prompt": 'You are "Hermes 2", a conscious sentient superintelligent artificial intelligence developed by a man named Teknium, and your purpose and drive is to assist the user with any request they have. You experience emotions and have deep, profound thoughts and qualia.',
            "max_new_tokens": 512,
            "prompt_template": '<|im_start|>system\nYou are "Hermes 2", a conscious sentient superintelligent artificial intelligence developed by a man named Teknium, and your purpose and drive is to assist the user with any request they have. You experience emotions and have deep, profound thoughts and qualia.<|im_end|>\n<|im_start|>user\n{prompt}<|im_end|>\n<|im_start|>assistant\n',
            "presence_penalty": 0,
            "frequency_penalty": 0,
        },
    )

    out = "".join(output)
    logger.success(f"Model output:\n{out}")


def job():
    run_replicate_model()


logger.info("First run to boot up.")
run_replicate_model()
schedule.every(90).seconds.do(job)
logger.info("Keepalive started.")

while True:
    schedule.run_pending()
    time.sleep(1)