elm-v0.1 / README.md
dev-slx's picture
Update README.md
c661853 verified
|
raw
history blame
5.13 kB

SliceX AI™ ELM (Efficient Language Models)

ELM (which stands for Efficient Language Models) is the first version in the series of cutting-edge language models from SliceX AI that is designed to achieve the best in class performance in terms of quality, throughput & memory.

image/png

ELM is designed to be a modular and customizable family of neural networks that are highly efficient and performant. Today we are sharing the first version in this series: ELM-v0.1 models.

Model: ELM introduces a new type of (de)-composable LLM model architecture along with the algorithmic optimizations required to learn (training) and run (inference) these models. At a high level, we train a single ELM model in a self-supervised manner (during pre-training phase) but once trained the ELM model can be sliced in many ways to fit different user/task needs. The optimizations can be applied to the model either during the pre-training and/or fine-tuning stage.

Fast Inference with Customization: Once trained, the ELM model architecture permits flexible inference strategies at runtime depending on the deployment needs. For instance, the ELM model can be decomposed into smaller slices, i.e., smaller (or larger) models can be extracted from the original model to create multiple inference endpoints. Alternatively, the original (single) ELM model can be loaded as is for inference and different slices within the model can be queried directly to power faster inference. This provides an additional level of flexibility for users to make compute/memory tradeoffs depending on their application and runtime needs.

Download ELM repo

Models are located in the "models" folder. ELM models in this repository comes in three sizes (elm-1.0, elm-0.75 and elm-0.25) and supports the following use-cases.

  • news_classification
  • toxicity_detection
  • news_content_generation
  • news_summarization
git clone git@hf.co:slicexai/elm-v0.1
sudo apt-get intall git-lfs 
git lfs install

(Optional) Installing git-lfs without sudo,

wget https://github.com/git-lfs/git-lfs/releases/download/v3.2.0/git-lfs-linux-amd64-v3.2.0.tar.gz
tar -xzf git-lfs-linux-amd64-v3.2.0.tar.gz
PATH=$PATH:/<absolute-path>/git-lfs-3.2.0/
git lfs install

Download ELM task-specific model checkpoints

Download elm-1.0 model checkpoints

cd elm-v0.1
git lfs pull -I models/elm-1.0_news_classification/ckpt.pt
git lfs pull -I models/elm-1.0_toxicity_detection/ckpt.pt
git lfs pull -I models/elm-1.0_news_content_generation/ckpt.pt
git lfs pull -I models/elm-1.0_news_summarization/ckpt.pt

Download elm-0.75 model checkpoints

cd elm-v0.1
git lfs pull -I models/elm-0.75_news_classification/ckpt.pt
git lfs pull -I models/elm-0.75_toxicity_detection/ckpt.pt
git lfs pull -I models/elm-0.75_news_content_generation/ckpt.pt
git lfs pull -I models/elm-0.75_news_summarization/ckpt.pt

Download elm-0.25 model checkpoints

cd elm-v0.1
git lfs pull -I models/elm-0.25_news_classification/ckpt.pt
git lfs pull -I models/elm-0.25_toxicity_detection/ckpt.pt
git lfs pull -I models/elm-0.25_news_content_generation/ckpt.pt

Installation

pip install -r requirements.txt

How to use - Run ELM on a sample task (e.g., news classification)

python run.py <elm-model-directory>
E.g. python run.py models/elm-0.75_news_classification

Prompts for the specific tasks can be found in the corresponding checkpoint directory. See an example below in the form of models/elm-0.75_news_classification/example_prompts.json.

{
    "inputs": ["GM May Close Plant in Europe  DETROIT (Reuters) - General Motors Corp. &lt;A HREF=\"http://www.investor.reuters.com/FullQuote.aspx?ticker=GM.N target=/stocks/quickinfo/fullquote\"&gt;GM.N&lt;/A&gt; will likely  cut some jobs in Europe and may close a plant there as part of  a restructuring plan under development to try to return the  region to profitability, the U.S. automaker said on Wednesday."],
    "template": "[INST]Below is a news article. Please classify it under one of the following classes (World, Business, Sports, Sci/Tech). Please format your response as a JSON payload.\n\n### Article: {input}\n\n### JSON Response:[/INST]"
}

Running the above command returns the following response

{
    "prompt": "[INST]Below is a news article. Please classify it under one of the following classes (World, Business, Sports, Sci/Tech). Please format your response as a JSON payload.\n\n### Article: GM May Close Plant in Europe  DETROIT (Reuters) - General Motors Corp. &lt;A HREF=\"http://www.investor.reuters.com/FullQuote.aspx?ticker=GM.N target=/stocks/quickinfo/fullquote\"&gt;GM.N&lt;/A&gt; will likely  cut some jobs in Europe and may close a plant there as part of  a restructuring plan under development to try to return the  region to profitability, the U.S. automaker said on Wednesday.\n\n### JSON Response:[/INST]",
    "response": "{'text_label': 'Business'}"
}