# 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-cases. - news_classification - toxicity_detection - news_content_generation - news_summarization ## Download ELM repo with model files ```bash sudo apt-get intall git-lfs git lfs install git clone ``` (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://git-lfs-3.2.0/ git lfs install ``` ## (Optional) Setup docker ```bash docker run --gpus all -it --shm-size=8g --name elm_inference --ulimit memlock=-1 --rm -v :/elm_code nvcr.io/nvidia/pytorch:23.09-py3 ``` ## Installation ```bash cd pip install -r requirements.txt ``` ## How to use - Run ELM on a sample task (e.g., news classification) ```bash python run.py 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`. ```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'}" } ```