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 torch | |
from fastapi import FastAPI, Request | |
from pydantic import BaseModel | |
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig | |
model_name = "name of model" | |
prompt_template = """ ### Input: {} ### Response: {}""" | |
stop_token_ids = [0] | |
app = FastAPI() |
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 asyncio | |
import nats | |
import uuid | |
async def aggregate_inferences(nats_url, request_subject, data, timeout=10): | |
nc = await nats.connect(nats_url) | |
responses = [] |
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
# Launch nats-server | |
# wget https://huggingface.co/remyxai/stablelm-zephyr-3B_localmentor/resolve/main/ggml-model-q4_0.gguf -o stablelm-localmentor_2.gguf | |
import nats | |
import asyncio | |
from llama_cpp import Llama | |
async def llm_runner(nats_url, model_path, subject): | |
nc = await nats.connect(nats_url) | |
llm = Llama(model_path) |
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
#!/usr/bin/env python | |
# coding=utf-8 | |
# Copyright 2023 The HuggingFace Inc. team. All rights reserved. | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# |
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
#!/bin/bash | |
# Ensure a list of clips is provided | |
if [ $# -eq 0 ]; then | |
echo "Please provide a list of clips to process and concatenate." | |
exit 1 | |
fi | |
# Directory to store processed clips | |
mkdir -p processed_clips |
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
model: | |
arch: video_llama | |
model_type: pretrain_vicuna | |
freeze_vit: True | |
freeze_qformer: True | |
max_txt_len: 160 | |
end_sym: "###" | |
low_resource: True | |
frozen_llama_proj: False |
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 os | |
import time | |
import cv2 | |
import hashlib | |
import numpy as np | |
from PIL import Image | |
from absl import logging | |
import tritonclient.http |
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
#!/usr/bin/env python3 | |
import sys | |
import rospy | |
import rostopic | |
import numpy as np | |
import message_filters |
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 cv2 | |
import numpy as np | |
from collections import deque | |
# https://github.com/elliottzheng/face-detection | |
from face_detection import RetinaFace | |
# https://pyscenedetect.readthedocs.io/projects/Manual/en/latest/api/scene_manager.html#scenemanager-example | |
from scenedetect import VideoManager | |
from scenedetect import SceneManager |
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
# http://index-of.es/Varios-2/Practical%20Python%20AI%20Projects%20Mathemathical%20Models%20of%20Optimization%20Problems%20with%20Google%20OR-Tools.pdf | |
# coding: utf-8 | |
""" | |
Example code for solving the transshipment problem. (pg. 111) | |
Input is an NxN numpy matrix (referenced here as D) | |
where row N is the demand and column N is the supply for each location 0 through N-1. | |
To solve, call the solve_model() function with matrix D as the input. | |
""" |
NewerOlder