This file contains hidden or 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
# %% | |
from openai import AsyncOpenAI | |
from openai.types.chat import ChatCompletion | |
from dotenv import load_dotenv | |
from tqdm.asyncio import tqdm as atqdm | |
import asyncio | |
import os | |
import nest_asyncio | |
import yaml |
This file contains hidden or 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
version: 1 | |
disable_existing_loggers: true | |
formatters: | |
standard_formatter: | |
format: "%(asctime)s %(levelname)7s %(name)s: %(message)s" | |
datefmt: "%Y-%m-%d %H:%M:%S" | |
handlers: | |
console: | |
formatter: standard_formatter |
This file contains hidden or 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
from numpy.typing import NDArray | |
from pydantic import BaseModel, BeforeValidator, ConfigDict, PlainSerializer | |
from typing_extensions import Annotated | |
import json | |
import numpy as np | |
# define serializers and validator | |
def nd_array_custom_before_validator(x: list[float]) -> NDArray[np.float32]: |
This file contains hidden or 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
FROM python:3.12.3 | |
RUN pip install \ | |
pandas \ | |
scikit-learn \ | |
fastapi \ | |
aiofiles |
This file contains hidden or 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
from typing import Any | |
from pydantic import BaseModel, root_validator | |
import json | |
# this dictionary will collect all classes constructors | |
class_registry: dict[str, Any] = dict() | |
# base class | |
class Creature(BaseModel): |
This file contains hidden or 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
from sqlalchemy import create_engine | |
from sqlalchemy import select, insert, func | |
from tables import Base, Record | |
from time import time | |
import ray | |
import uuid |
This file contains hidden or 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
from multiprocessing import Queue, Process | |
import random | |
import time | |
import signal | |
stop_sentinel = "STOP" | |
This file contains hidden or 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
from pydantic import BaseModel | |
from enum import Enum | |
import json | |
class Season(str, Enum): | |
SPRING = 'spring' | |
SUMMER = 'summer' | |
AUTUMN = 'autumn' |
This file contains hidden or 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
import time | |
import multiprocessing | |
import signal | |
from multiprocessing import Event | |
class W(multiprocessing.Process): | |
def __init__(self, i: int, event: Event) -> None: | |
super().__init__() |
NewerOlder