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 Generator | |
from threading import Thread | |
import torch | |
from litserve.api import LitAPI | |
from litserve import LitServer | |
from pydantic import BaseModel | |
from transformers import AutoModelForCausalLM, AutoTokenizer, TextIteratorStreamer |
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
# Adapted from https://docs.streamlit.io/knowledge-base/tutorials/build-conversational-apps#build-a-simple-chatbot-gui-with-streaming | |
import streamlit as st | |
import gemma | |
model = "Gemma" | |
def chat(prompt, model=model, context=None, **kwargs): | |
"""streaming client with ollama""" |
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 | |
model = "google/gemma-7b-it" | |
os.environ["HF_HOME"] = "/teamspace/studios/this_studio/weights" | |
os.environ["TRANSFORMERS_OFFLINE"] = "1" | |
import warnings | |
warnings.filterwarnings("ignore", category=UserWarning) |
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
MODEL=TinyLlama/TinyLlama-1.1B-intermediate-step-1431k-3T | |
# Install | |
git clone https://github.com/Lightning-AI/lit-gpt.git | |
cd lit-gpt | |
pip install -r requirements-all.txt | |
# Download weights | |
python scripts/download.py --repo_id $MODEL |
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 argparse | |
import numpy as np | |
from PIL import Image | |
from functools import lru_cache | |
@lru_cache(maxsize=None) # Cache all generated images | |
def generate_random_image(width, height): | |
# Create a random RGB image | |
image_data = np.random.randint(0, 256, (height, width, 3), dtype=np.uint8) |
We can't make this file beautiful and searchable because it's too large.
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
instruction,category,input,output | |
When did Virgin Australia start operating?,closed_qa,"Virgin Australia, the trading name of Virgin Australia Airlines Pty Ltd, is an Australian-based airline. It is the largest airline by fleet size to use the Virgin brand. It commenced services on 31 August 2000 as Virgin Blue, with two aircraft on a single route. It suddenly found itself as a major airline in Australia's domestic market after the collapse of Ansett Australia in September 2001. The airline has since grown to directly serve 32 cities in Australia, from hubs in Brisbane, Melbourne and Sydney.","Virgin Australia commenced services on 31 August 2000 as Virgin Blue, with two aircraft on a single route." | |
Which is a species of fish? Tope or Rope,classification,,Tope | |
Why can camels survive for long without water?,open_qa,,Camels use the fat in their humps to keep them filled with energy and hydration for long periods of time. | |
"Alice's parents have three daughters: Amy, Jessy, and what’s the name of the third daughte |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
NewerOlder