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
from typing import List, Dict, Literal, Union | |
from transformers import AutoTokenizer | |
class MistralAICtx: | |
def __init__(self, model_name: str): | |
assert "mistral" in model_name, "MistralCtx only available for Mistral models" | |
self.tokenizer = AutoTokenizer.from_pretrained( | |
"mistralai/Mistral-7B-Instruct-v0.2") |
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
import math | |
import re | |
from urllib import request | |
from io import BytesIO | |
import base64 | |
from PIL import Image | |
from typing import Literal | |
def getImageDimensions(image: str): # base64 or url |
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
<script> | |
// @ts-nocheck | |
import mermaid from "mermaid"; | |
import { onMount } from "svelte"; | |
import { browser } from "$app/environment"; | |
import MarkdownRenderer from "../components/MarkdownRenderer.svelte"; | |
import Spinner from "../components/Spinner.svelte"; | |
$: inputText = ``; | |
$: thoughtProcess = ``; |
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
import torch as T | |
import torch.nn.functional as F | |
import torch.nn as nn | |
import numpy as np | |
import os | |
import re | |
from bert4rec_model import RecommendationTransformer | |
from constants import TRAIN_CONSTANTS | |
from typing import List, Dict, Tuple | |
import random |
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
from train_pipeline import trainer | |
from constants import TRAIN_CONSTANTS | |
from rich.table import Column, Table | |
from rich import box | |
from rich.console import Console | |
console = Console(record=True) | |
training_logger = Table( |
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
import os | |
import re | |
import pandas as pd | |
from tqdm import trange, tnrange | |
import torch as T | |
import torch.nn as nn | |
import torch.nn.functional as F | |
from torch.utils.data import DataLoader | |
from bert4rec_dataset import Bert4RecDataset | |
from bert4rec_model import RecommendationModel, RecommendationTransformer |
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
import os | |
from requests import head | |
import torch as T | |
import torch.nn as nn | |
import torch.nn.functional as F | |
from modules import Encoder, Decoder | |
class RecommendationTransformer(nn.Module): | |
"""Sequential recommendation model architecture |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
from typing import List | |
from fastapi import FastAPI, Header, WebSocket, WebSocketDisconnect | |
import uvicorn | |
app = FastAPI() | |
class ConnectionManager: | |
def __init__(self): | |
self.active_connections: List[WebSocket] = [] | |
async def connect(self, websocket: WebSocket): |
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
# Define function directory | |
ARG FUNCTION_DIR="/function" | |
FROM python:3.7 as build-image | |
RUN apt-get update | |
RUN apt-get install -y |
NewerOlder