File size: 2,742 Bytes
9513141 0f65dcc 9513141 4df67d3 9513141 0f65dcc 9513141 0f65dcc 9513141 2a1246d 9513141 11d1de1 9513141 33022c7 9513141 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# SliceX AI™ ELM (Efficient Language Models)
This repository contains code to run our ELM models.
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-case.
- news_classification
Try out the ELM models in HF spaces at [slicexai/elm-demo-v1](https://huggingface.co/spaces/slicexai/elm-demo-v1)
## Download ELM repo
```bash
sudo apt-get intall git-lfs
git lfs install
git clone [email protected]:slicexai/elm-v0.1_news_classification
```
(Optional) Installing git-lfs without sudo,
```bash
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
```
## Installation
```bash
cd elm-v0.1_news_classification
pip install -r requirements.txt
```
## How to use - Run ELM on a sample task
```bash
python run.py <elm-model-directory>
- python run.py models/elm-1.0_news_classification
- python run.py models/elm-0.75_news_classification
- python run.py models/elm-0.25_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`.
```json
{
"inputs": ["GM May Close Plant in Europe DETROIT (Reuters) - General Motors Corp. <A HREF=\"http://www.investor.reuters.com/FullQuote.aspx?ticker=GM.N target=/stocks/quickinfo/fullquote\">GM.N</A> 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
```json
{
"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. <A HREF=\"http://www.investor.reuters.com/FullQuote.aspx?ticker=GM.N target=/stocks/quickinfo/fullquote\">GM.N</A> 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'}"
}
``` |