GithubHelp home page GithubHelp logo

stablelm-truss-local-weights's Introduction

StableLM Truss

This repository packages StableLM as a Truss.

Deploying StableLM

Stability AI recently announced the ongoing development of the StableLM series of language models, and simultaneously released a number of checkpoints for this model.

Utilizing these models for inference can be challenging given the hardware requirements. With Baseten and Truss, this can be dead simple. You can see the full code repository here.

There are four models that were released:

  • "stabilityai/stablelm-base-alpha-7b"
  • "stabilityai/stablelm-tuned-alpha-7b"
  • "stabilityai/stablelm-base-alpha-3b"
  • "stabilityai/stablelm-tuned-alpha-3b"

You can modify the load method in model.py to select the version you'd like to deploy.

model_name = "stabilityai/stablelm-tuned-alpha-7b" #@param ["stabilityai/stablelm-base-alpha-7b", "stabilityai/stablelm-tuned-alpha-7b", "stabilityai/stablelm-base-alpha-3b", "stabilityai/stablelm-tuned-alpha-3b"]

We found this model runs reasonably fast on A10Gs; you can configure the hardware you'd like in the config.yaml.

...
resources:
  cpu: "3"
  memory: 14Gi
  use_gpu: true
  accelerator: A10G
...

The usual GPT-style parameters will pass right through to the inference point:

  • max_new_tokens (default: 64)
  • temperature (default: 0.5)
  • top_p (default: 0.9)
  • top_k (default: 0)
  • num_beams (default: 4)

If the tuned versions are needed for use in Chatbots; prepend the input message with the system prompt as described in the StableLM Readme:

system_prompt = """<|SYSTEM|># StableLM Tuned (Alpha version)
- StableLM is a helpful and harmless open-source AI language model developed by StabilityAI.
- StableLM is excited to be able to help the user, but will refuse to do anything that could be considered harmful to the user.
- StableLM is more than just an information source, StableLM is also able to write poetry, short stories, and make jokes.
- StableLM will refuse to participate in anything that could harm a human.
"""

prompt = f"{system_prompt}<|USER|>What's your mood today?<|ASSISTANT|>"

Deploying the Truss is easy; simply load it and push.

import baseten
import truss

stablelm_truss = truss.load('.')
baseten.deploy(stablelm_truss)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.