Instructions to use Locutusque/SlimHercules-4.0-Mistral-7B-v0.2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Locutusque/SlimHercules-4.0-Mistral-7B-v0.2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Locutusque/SlimHercules-4.0-Mistral-7B-v0.2")# Load model directly from transformers import AutoTokenizer, AutoModelForMultimodalLM tokenizer = AutoTokenizer.from_pretrained("Locutusque/SlimHercules-4.0-Mistral-7B-v0.2") model = AutoModelForMultimodalLM.from_pretrained("Locutusque/SlimHercules-4.0-Mistral-7B-v0.2") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Locutusque/SlimHercules-4.0-Mistral-7B-v0.2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Locutusque/SlimHercules-4.0-Mistral-7B-v0.2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Locutusque/SlimHercules-4.0-Mistral-7B-v0.2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Locutusque/SlimHercules-4.0-Mistral-7B-v0.2
- SGLang
How to use Locutusque/SlimHercules-4.0-Mistral-7B-v0.2 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 "Locutusque/SlimHercules-4.0-Mistral-7B-v0.2" \ --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": "Locutusque/SlimHercules-4.0-Mistral-7B-v0.2", "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 "Locutusque/SlimHercules-4.0-Mistral-7B-v0.2" \ --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": "Locutusque/SlimHercules-4.0-Mistral-7B-v0.2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Locutusque/SlimHercules-4.0-Mistral-7B-v0.2 with Docker Model Runner:
docker model run hf.co/Locutusque/SlimHercules-4.0-Mistral-7B-v0.2
Model Card: SlimHercules-4.0-Mistral-v0.2-7B
Model Description
SlimHercules-4.0-Mistral-v0.2-7B is a fine-tuned language model derived from Mistralai/Mistral-7B-v0.2. It is specifically designed to excel in instruction following, function calls, and conversational interactions across various scientific and technical domains. The dataset used for fine-tuning, also named hercules-v4.0, expands upon the diverse capabilities of OpenHermes-2.5 with contributions from numerous curated datasets. This fine-tuning has hercules-v4.0 with enhanced abilities in:
- Complex Instruction Following: Understanding and accurately executing multi-step instructions, even those involving specialized terminology.
- Function Calling: Seamlessly interpreting and executing function calls, providing appropriate input and output values.
- Domain-Specific Knowledge: Engaging in informative and educational conversations about Biology, Chemistry, Physics, Mathematics, Medicine, Computer Science, and more.
This model is different in the sense that the dataset was shrunk and not shuffled, that way every dataset could be incorporated, without performance loss. This, in theory, should have much better performance in comparison to it's predecessors.
I will be evaluating this in the future.
Quants
EXL2 @bartowski
GGUF @bartowski
AWQ @solidrust
Intended Uses & Potential Bias
SlimHercules-4.0-Mistral-v0.2-7B is well-suited to the following applications:
- Specialized Chatbots: Creating knowledgeable chatbots and conversational agents in scientific and technical fields.
- Instructional Assistants: Supporting users with educational and step-by-step guidance in various disciplines.
- Code Generation and Execution: Facilitating code execution through function calls, aiding in software development and prototyping.
Important Note: Although Hercules-v4.0 is carefully constructed, it's important to be aware that the underlying data sources may contain biases or reflect harmful stereotypes. Use this model with caution and consider additional measures to mitigate potential biases in its responses.
Limitations and Risks
- Toxicity: The dataset contains toxic or harmful examples.
- Hallucinations and Factual Errors: Like other language models, SlimHercules-4.0-Mistral-v0.2-7B may generate incorrect or misleading information, especially in specialized domains where it lacks sufficient expertise.
- Potential for Misuse: The ability to engage in technical conversations and execute function calls could be misused for malicious purposes.
Training Procedure
- This model was trained on 8 kaggle TPUs, using torch xla SPMD for high MXU efficiency. There was no expense on my end (meaning you can reproduce this too!)
- A learning rate of 4e-06 with the Adam optimizer. A linear scheduler was used, with an end factor of 0.1. A low learning rate was used to prevent exploding gradients.
- No mixed precision was used, with the default dtype being bfloat16.
- A total batch size of 128 was used.
- Trained for two epochs on a shrunk and unshuffled version of Hercules-v4.0
- No model parameters were frozen and no quantization was used.
- This model was trained on OpenAI's ChatML prompt format. Because this model has function calling capabilities, the prompt format is slightly different, here's what it would look like:
<|im_start|>system\n{message}<|im_end|>\n<|im_start|>user\n{user message}<|im_end|>\n<|im_start|>call\n{function call message}<|im_end|>\n<|im_start|>function\n{function response message}<|im_end|>\n<|im_start|>assistant\n{assistant message}</s>
This model was fine-tuned using my TPU-Alignment repository. https://github.com/Locutusque/TPU-Alignment
Evaluation
AGIEval
| Tasks | Version | Filter | n-shot | Metric | Value | Stderr | |
|---|---|---|---|---|---|---|---|
| agieval_nous | N/A | none | 0 | acc_norm | 0.3559 | ± | 0.0093 |
| none | 0 | acc | 0.3759 | ± | 0.0093 | ||
| - agieval_aqua_rat | 1 | none | 0 | acc | 0.2087 | ± | 0.0255 |
| none | 0 | acc_norm | 0.2126 | ± | 0.0257 | ||
| - agieval_logiqa_en | 1 | none | 0 | acc | 0.3041 | ± | 0.0180 |
| none | 0 | acc_norm | 0.3456 | ± | 0.0187 | ||
| - agieval_lsat_ar | 1 | none | 0 | acc | 0.2478 | ± | 0.0285 |
| none | 0 | acc_norm | 0.2348 | ± | 0.0280 | ||
| - agieval_lsat_lr | 1 | none | 0 | acc | 0.3961 | ± | 0.0217 |
| none | 0 | acc_norm | 0.3627 | ± | 0.0213 | ||
| - agieval_lsat_rc | 1 | none | 0 | acc | 0.5056 | ± | 0.0305 |
| none | 0 | acc_norm | 0.4387 | ± | 0.0303 | ||
| - agieval_sat_en | 1 | none | 0 | acc | 0.7136 | ± | 0.0316 |
| none | 0 | acc_norm | 0.6456 | ± | 0.0334 | ||
| - agieval_sat_en_without_passage | 1 | none | 0 | acc | 0.4417 | ± | 0.0347 |
| none | 0 | acc_norm | 0.3689 | ± | 0.0337 | ||
| - agieval_sat_math | 1 | none | 0 | acc | 0.3318 | ± | 0.0318 |
| none | 0 | acc_norm | 0.2773 | ± | 0.0302 |
| Groups | Version | Filter | n-shot | Metric | Value | Stderr | |
|---|---|---|---|---|---|---|---|
| agieval_nous | N/A | none | 0 | acc_norm | 0.3559 | ± | 0.0093 |
| none | 0 | acc | 0.3759 | ± | 0.0093 | ||
| truthfulqa_mc1 | 2 | none | 0 | acc | 0.3219 | ± | 0.0164 |
| gsm8k | 3 | strict-match | 5 | exact_match | 0.4678 | ± | 0.0137 |
| flexible-extract | 5 | exact_match | 0.4678 | ± | 0.0137 | ||
| ai2_arc | N/A | none | 0 | acc | 0.6962 | ± | 0.0073 |
| none | 0 | acc_norm | 0.7024 | ± | 0.0074 |
- Downloads last month
- 6
Model tree for Locutusque/SlimHercules-4.0-Mistral-7B-v0.2
Base model
mistral-community/Mistral-7B-v0.2