init commit
Browse files
README.md
ADDED
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# SliceX AI™ ELM (Efficient Language Models)
|
2 |
+
This repository contains code to run our ELM models.
|
3 |
+
|
4 |
+
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.
|
5 |
+
- news_classification
|
6 |
+
- toxicity_detection
|
7 |
+
- news_content_generation
|
8 |
+
- news_summarization
|
9 |
+
|
10 |
+
## Download ELM repo
|
11 |
+
```bash
|
12 |
+
git clone git@hf.co:slicexai/elm-v0.1
|
13 |
+
sudo apt-get intall git-lfs
|
14 |
+
git lfs install
|
15 |
+
```
|
16 |
+
(Optional) Installing git-lfs without sudo,
|
17 |
+
```bash
|
18 |
+
wget https://github.com/git-lfs/git-lfs/releases/download/v3.2.0/git-lfs-linux-amd64-v3.2.0.tar.gz
|
19 |
+
tar -xzf git-lfs-linux-amd64-v3.2.0.tar.gz
|
20 |
+
PATH=$PATH:/<absolute-path>/git-lfs-3.2.0/
|
21 |
+
git lfs install
|
22 |
+
```
|
23 |
+
|
24 |
+
## Download ELM task-specific model checkpoints
|
25 |
+
|
26 |
+
Download elm-1.0 model checkpoints
|
27 |
+
```bash
|
28 |
+
cd elm-v0.1
|
29 |
+
git lfs pull models/elm-1.0_news_classification/ckpt.pt
|
30 |
+
git lfs pull models/elm-1.0_toxicity_detection/ckpt.pt
|
31 |
+
git lfs pull models/elm-1.0_news_content_generation/ckpt.pt
|
32 |
+
git lfs pull models/elm-1.0_news_summarization/ckpt.pt
|
33 |
+
```
|
34 |
+
|
35 |
+
Download elm-0.75 model checkpoints
|
36 |
+
```bash
|
37 |
+
cd elm-v0.1
|
38 |
+
git lfs pull models/elm-0.75_news_classification/ckpt.pt
|
39 |
+
git lfs pull models/elm-0.75_toxicity_detection/ckpt.pt
|
40 |
+
git lfs pull models/elm-0.75_news_content_generation/ckpt.pt
|
41 |
+
git lfs pull models/elm-0.75_news_summarization/ckpt.pt
|
42 |
+
```
|
43 |
+
|
44 |
+
Download elm-0.25 model checkpoints
|
45 |
+
```bash
|
46 |
+
cd elm-v0.1
|
47 |
+
git lfs pull models/elm-0.25_news_classification/ckpt.pt
|
48 |
+
git lfs pull models/elm-0.25_toxicity_detection/ckpt.pt
|
49 |
+
git lfs pull models/elm-0.25_news_content_generation/ckpt.pt
|
50 |
+
git lfs pull models/elm-0.25_news_summarization/ckpt.pt
|
51 |
+
```
|
52 |
+
|
53 |
+
|
54 |
+
## Installation
|
55 |
+
```bash
|
56 |
+
pip install -r requirements.txt
|
57 |
+
```
|
58 |
+
|
59 |
+
## How to use - Run ELM on a sample task (e.g., news classification)
|
60 |
+
```bash
|
61 |
+
python run.py <elm-model-directory>
|
62 |
+
E.g. python run.py models/elm-0.75_news_classification
|
63 |
+
```
|
64 |
+
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`.
|
65 |
+
```json
|
66 |
+
{
|
67 |
+
"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."],
|
68 |
+
"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]"
|
69 |
+
}
|
70 |
+
```
|
71 |
+
|
72 |
+
Running the above command returns the following response
|
73 |
+
|
74 |
+
```json
|
75 |
+
{
|
76 |
+
"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]",
|
77 |
+
"response": "{'text_label': 'Business'}"
|
78 |
+
}
|
79 |
+
```
|