| 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) | |