Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,99 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: apache-2.0
|
| 3 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
base_model: mistralai/Mistral-7B-Instruct-v0.2
|
| 4 |
+
tags:
|
| 5 |
+
- mistral
|
| 6 |
+
- fine-tuned
|
| 7 |
+
- RAG
|
| 8 |
+
- instruction-tuning
|
| 9 |
+
- hai-indexer
|
| 10 |
+
- en
|
| 11 |
+
language:
|
| 12 |
+
- en
|
| 13 |
+
pipeline_tag: text-generation
|
| 14 |
+
---
|
| 15 |
+
|
| 16 |
+
# Hai Indexer 7B
|
| 17 |
+
|
| 18 |
+
HAI Indexer is a fine-tuned Mistral-7B-Instruct model specialized for RAG (Retrieval Augmented Generation), company knowledge base QA, entity classification, and safety-aware responses.
|
| 19 |
+
|
| 20 |
+
## Model Details
|
| 21 |
+
|
| 22 |
+
- **Base model:** [mistralai/Mistral-7B-Instruct-v0.2](https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.2)
|
| 23 |
+
- **Training:** Supervised fine-tuning (SFT) via LoRA, merged into base
|
| 24 |
+
- **Architecture:** MistralForCausalLM, 7B parameters
|
| 25 |
+
- **Max context:** 32,768 tokens
|
| 26 |
+
- **License:** Apache 2.0
|
| 27 |
+
|
| 28 |
+
## Training Data
|
| 29 |
+
|
| 30 |
+
The model was trained on multiple datasets including:
|
| 31 |
+
|
| 32 |
+
- **RAG / retrieval** – answering from provided context
|
| 33 |
+
- **Business integration** – domain-specific knowledge
|
| 34 |
+
- **Company knowledge base** – internal KB QA
|
| 35 |
+
- **Entity classification** – entity recognition
|
| 36 |
+
- **Anti-hallucination** – staying grounded in context
|
| 37 |
+
- **Safety guardrails** – safe responses
|
| 38 |
+
- **Introduction / operator** – assistant identity and behavior
|
| 39 |
+
|
| 40 |
+
## Intended Use
|
| 41 |
+
|
| 42 |
+
- RAG pipelines with retrieved context
|
| 43 |
+
- Company or internal knowledge base Q&A
|
| 44 |
+
- Instruction-following assistant with grounding in provided documents
|
| 45 |
+
- General chat when used with appropriate system prompts
|
| 46 |
+
|
| 47 |
+
## How to Use
|
| 48 |
+
|
| 49 |
+
### With Transformers
|
| 50 |
+
|
| 51 |
+
```python
|
| 52 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 53 |
+
|
| 54 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 55 |
+
"Haiintel/hai-indexer-7B",
|
| 56 |
+
torch_dtype="auto",
|
| 57 |
+
device_map="auto",
|
| 58 |
+
)
|
| 59 |
+
tokenizer = AutoTokenizer.from_pretrained("Haiintel/hai-indexer-7B")
|
| 60 |
+
|
| 61 |
+
messages = [{"role": "user", "content": "What is HAI Indexer?"}]
|
| 62 |
+
text = tokenizer.apply_chat_template(
|
| 63 |
+
messages,
|
| 64 |
+
tokenize=False,
|
| 65 |
+
add_generation_prompt=True,
|
| 66 |
+
)
|
| 67 |
+
inputs = tokenizer(text, return_tensors="pt").to(model.device)
|
| 68 |
+
outputs = model.generate(**inputs, max_new_tokens=256)
|
| 69 |
+
response = tokenizer.decode(
|
| 70 |
+
outputs[0][inputs["input_ids"].shape[1]:],
|
| 71 |
+
skip_special_tokens=True,
|
| 72 |
+
)
|
| 73 |
+
print(response)
|
| 74 |
+
```
|
| 75 |
+
|
| 76 |
+
### RAG-style (with context)
|
| 77 |
+
|
| 78 |
+
```python
|
| 79 |
+
context = "Your retrieved documents here..."
|
| 80 |
+
query = "Your question here"
|
| 81 |
+
|
| 82 |
+
messages = [
|
| 83 |
+
{"role": "system", "content": "Answer based on the context provided."},
|
| 84 |
+
{"role": "user", "content": f"Context:\n{context}\n\nQuestion: {query}"},
|
| 85 |
+
]
|
| 86 |
+
# Then apply_chat_template + generate as above
|
| 87 |
+
```
|
| 88 |
+
|
| 89 |
+
## Limitations
|
| 90 |
+
|
| 91 |
+
- Performance depends on retrieval quality in RAG setups
|
| 92 |
+
- May reflect biases or errors in training data
|
| 93 |
+
- Not designed for medical, legal, or high-stakes decisions without review
|
| 94 |
+
|
| 95 |
+
## Acknowledgments
|
| 96 |
+
|
| 97 |
+
- [Mistral AI](https://mistral.ai/) for the base model
|
| 98 |
+
- [LLaMA-Factory](https://github.com/hiyouga/LLaMA-Factory) for training
|
| 99 |
+
- HAI Intel for fine-tuning and deployment
|