Instructions to use llmware/slim-sentiment with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use llmware/slim-sentiment with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="llmware/slim-sentiment")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("llmware/slim-sentiment") model = AutoModelForCausalLM.from_pretrained("llmware/slim-sentiment", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use llmware/slim-sentiment with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "llmware/slim-sentiment" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "llmware/slim-sentiment", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/llmware/slim-sentiment
- SGLang
How to use llmware/slim-sentiment with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "llmware/slim-sentiment" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "llmware/slim-sentiment", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "llmware/slim-sentiment" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "llmware/slim-sentiment", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use llmware/slim-sentiment with Docker Model Runner:
docker model run hf.co/llmware/slim-sentiment
Update README.md
Browse files
README.md
CHANGED
|
@@ -34,7 +34,7 @@ Inference speed and loading time is much faster with the 'tool' versions of the
|
|
| 34 |
The intended use of SLIM models is to re-imagine traditional 'hard-coded' classifiers through the use of function calls, and to provide a natural language flexible tool that can be used as decision gates and processing steps in a complex LLM-based automation workflow.
|
| 35 |
|
| 36 |
<details>
|
| 37 |
-
<summary><
|
| 38 |
|
| 39 |
model = AutoModelForCausalLM.from_pretrained("llmware/slim-sentiment")
|
| 40 |
tokenizer = AutoTokenizer.from_pretrained("llmware/slim-sentiment")
|
|
@@ -42,7 +42,6 @@ The intended use of SLIM models is to re-imagine traditional 'hard-coded' classi
|
|
| 42 |
function = "classify"
|
| 43 |
params = "sentiment"
|
| 44 |
|
| 45 |
-
text = "That was the worst earnings call of the year. The CEO should be fired."
|
| 46 |
text = "The stock market declined yesterday as investors worried increasingly about the slowing economy."
|
| 47 |
|
| 48 |
prompt = "<human>: " + text + "\n" + f"<{function}> {params} </{function}>\n<bot>:"
|
|
@@ -69,7 +68,7 @@ Sample output:
|
|
| 69 |
{"sentiment": ["negative"]}
|
| 70 |
|
| 71 |
|
| 72 |
-
|
| 73 |
|
| 74 |
"<human> " + {text} + "\n" +
|
| 75 |
|
|
|
|
| 34 |
The intended use of SLIM models is to re-imagine traditional 'hard-coded' classifiers through the use of function calls, and to provide a natural language flexible tool that can be used as decision gates and processing steps in a complex LLM-based automation workflow.
|
| 35 |
|
| 36 |
<details>
|
| 37 |
+
<summary><b>Getting Started: </b> </summary>
|
| 38 |
|
| 39 |
model = AutoModelForCausalLM.from_pretrained("llmware/slim-sentiment")
|
| 40 |
tokenizer = AutoTokenizer.from_pretrained("llmware/slim-sentiment")
|
|
|
|
| 42 |
function = "classify"
|
| 43 |
params = "sentiment"
|
| 44 |
|
|
|
|
| 45 |
text = "The stock market declined yesterday as investors worried increasingly about the slowing economy."
|
| 46 |
|
| 47 |
prompt = "<human>: " + text + "\n" + f"<{function}> {params} </{function}>\n<bot>:"
|
|
|
|
| 68 |
{"sentiment": ["negative"]}
|
| 69 |
|
| 70 |
|
| 71 |
+
## Prompt Instruction format: all of the SLIM models use a novel prompt instruction structured as follows:
|
| 72 |
|
| 73 |
"<human> " + {text} + "\n" +
|
| 74 |
|