Update README.md
Browse files
README.md
CHANGED
|
@@ -1,98 +1,77 @@
|
|
| 1 |
---
|
| 2 |
-
license:
|
| 3 |
-
datasets:
|
| 4 |
-
- yashsoni78/conversation_data_mcp_100
|
| 5 |
-
language:
|
| 6 |
-
- en
|
| 7 |
-
base_model:
|
| 8 |
-
- mistralai/Mistral-7B-Instruct-v0.2
|
| 9 |
-
library_name: adapter-transformers
|
| 10 |
tags:
|
| 11 |
-
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
| 19 |
---
|
| 20 |
-
## Model Description
|
| 21 |
-
|
| 22 |
-
This model was fine-tuned using **Parameter-Efficient Fine-Tuning (PEFT)** with **LoRA** on a custom, high-quality dataset. Its primary skill is to receive a user prompt and generate a tool call in a specific, sandboxed format. While the fine-tuning has exposed it to several tool types, its core capability is understanding the intent to use a tool and structuring the output accordingly.
|
| 23 |
|
| 24 |
-
|
| 25 |
|
| 26 |
-
|
| 27 |
|
| 28 |
-
|
| 29 |
|
| 30 |
-
|
| 31 |
-
|
|
|
|
|
|
|
| 32 |
|
| 33 |
-
|
| 34 |
-
## How to Use
|
| 35 |
|
| 36 |
-
|
| 37 |
|
| 38 |
```python
|
| 39 |
-
import torch
|
| 40 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 41 |
-
|
|
|
|
|
|
|
| 42 |
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
# Replace with your actual model repository ID on the Hub
|
| 46 |
-
FINE_TUNED_REPO_ID = "yashsoni78/mcp_tool_model"
|
| 47 |
-
DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
|
| 48 |
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
BASE_MODEL_REPO_ID,
|
| 53 |
-
torch_dtype=torch.bfloat16,
|
| 54 |
-
device_map=DEVICE
|
| 55 |
-
)
|
| 56 |
|
| 57 |
-
print(
|
| 58 |
-
|
| 59 |
|
| 60 |
-
|
| 61 |
-
base_model.resize_token_embeddings(len(tokenizer))
|
| 62 |
|
| 63 |
-
|
| 64 |
-
model = PeftModel.from_pretrained(base_model, FINE_TUNED_REPO_ID)
|
| 65 |
-
model = model.merge_and_unload()
|
| 66 |
-
model.eval() # Set the model to evaluation mode
|
| 67 |
|
| 68 |
-
|
| 69 |
|
| 70 |
-
|
| 71 |
-
system_prompt = "You are an expert assistant that uses MCP tools. When a tool is required, you must respond *only* with the 'tool_code' format."
|
| 72 |
-
user_prompt = "What's the status of my 'database-main' VM?"
|
| 73 |
|
| 74 |
-
|
| 75 |
-
|
|
|
|
|
|
|
| 76 |
|
| 77 |
-
|
| 78 |
-
response = tokenizer.decode(outputs[0], skip_special_tokens=True).split("ASSISTANT:")[1].strip()
|
| 79 |
|
| 80 |
-
|
| 81 |
-
|
|
|
|
| 82 |
|
| 83 |
-
|
| 84 |
|
| 85 |
-
|
| 86 |
|
| 87 |
-
|
| 88 |
-
* **Fine-Tuning Method:** PEFT (LoRA) with 4-bit quantization (`bitsandbytes`).
|
| 89 |
-
* **Dataset:** The model was trained on a curated, high-quality dataset containing a balanced mix of tool-calling examples and conversational ("negative") examples to teach it when *not* to call a tool. Special tokens `[TOOL_CODE_START]` and `[TOOL_CODE_END]` were added to the vocabulary.
|
| 90 |
-
* **Training Procedure:** The model was trained using the `SFTTrainer` from the TRL library.
|
| 91 |
|
| 92 |
-
|
| 93 |
|
| 94 |
-
|
| 95 |
-
* **Scope:** The model's knowledge is limited to the patterns and tools seen during fine-tuning. It cannot use new tools without being re-trained.
|
| 96 |
-
* **Language:** The model was trained exclusively on English language prompts.
|
| 97 |
|
| 98 |
-
|
|
|
|
| 1 |
---
|
| 2 |
+
license: mit
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
tags:
|
| 4 |
+
- conversational
|
| 5 |
+
- text-generation
|
| 6 |
+
- instruction-tuned
|
| 7 |
+
- chat
|
| 8 |
+
- dialogue
|
| 9 |
+
language:
|
| 10 |
+
- en
|
| 11 |
+
datasets:
|
| 12 |
+
- yashsoni78/conversation_data_mcp_100
|
| 13 |
+
library_name: transformers
|
| 14 |
+
pipeline_tag: text-generation
|
| 15 |
---
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
+
# π οΈ MCP Tool Model
|
| 18 |
|
| 19 |
+
The **MCP Tool Model** is an instruction-tuned conversational language model fine-tuned on the [`conversation_data_mcp_100`](https://huggingface.co/datasets/yashsoni78/conversation_data_mcp_100) dataset. Built to handle multi-turn dialogues with clarity and coherence, this model is ideal for chatbot development, virtual assistants, or any conversational AI tasks.
|
| 20 |
|
| 21 |
+
## π§ Model Details
|
| 22 |
|
| 23 |
+
- **Base Model**: *mistralai/Mistral-7B-Instruct-v0.2*
|
| 24 |
+
- **Fine-tuned on**: Custom multi-turn conversation dataset (`yashsoni78/conversation_data_mcp_100`)
|
| 25 |
+
- **Languages**: English
|
| 26 |
+
- **Use case**: General-purpose chatbot or instruction-following agent
|
| 27 |
|
| 28 |
+
## π Example Usage
|
|
|
|
| 29 |
|
| 30 |
+
You can load and use the model with the Hugging Face Transformers library:
|
| 31 |
|
| 32 |
```python
|
|
|
|
| 33 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 34 |
+
import torch
|
| 35 |
+
|
| 36 |
+
model_name = "yashsoni78/mcp_tool_model"
|
| 37 |
|
| 38 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 39 |
+
model = AutoModelForCausalLM.from_pretrained(model_name)
|
|
|
|
|
|
|
|
|
|
| 40 |
|
| 41 |
+
input_text = "User: How do I reset my password?\nAssistant:"
|
| 42 |
+
inputs = tokenizer(input_text, return_tensors="pt")
|
| 43 |
+
outputs = model.generate(**inputs, max_new_tokens=100)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
|
| 45 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
| 46 |
+
```
|
| 47 |
|
| 48 |
+
> π‘ Make sure to adapt the prompt formatting depending on your training setup (e.g., special tokens, roles, etc.)
|
|
|
|
| 49 |
|
| 50 |
+
## π Training Data
|
|
|
|
|
|
|
|
|
|
| 51 |
|
| 52 |
+
This model was fine-tuned on the [MCP 100 conversation dataset](https://huggingface.co/datasets/yashsoni78/conversation_data_mcp_100), consisting of 100 high-quality multi-turn dialogues between users and assistants. Each exchange is structured to reflect real-world inquiry-response flows.
|
| 53 |
|
| 54 |
+
## π Intended Use
|
|
|
|
|
|
|
| 55 |
|
| 56 |
+
- Chatbots for websites or tools
|
| 57 |
+
- Instruction-following agents
|
| 58 |
+
- Dialogue research
|
| 59 |
+
- Voice assistant backend
|
| 60 |
|
| 61 |
+
## β οΈ Limitations
|
|
|
|
| 62 |
|
| 63 |
+
- May hallucinate facts or generate inaccurate responses.
|
| 64 |
+
- Trained on a small dataset (100 dialogues), so generalization may be limited.
|
| 65 |
+
- English only.
|
| 66 |
|
| 67 |
+
## π License
|
| 68 |
|
| 69 |
+
This model is licensed under the [MIT License](https://opensource.org/licenses/MIT). You are free to use, modify, and distribute it with attribution.
|
| 70 |
|
| 71 |
+
## π Acknowledgements
|
|
|
|
|
|
|
|
|
|
| 72 |
|
| 73 |
+
Special thanks to the open-source community and Hugging Face for providing powerful tools to build and share models easily.
|
| 74 |
|
| 75 |
+
## π¬ Contact
|
|
|
|
|
|
|
| 76 |
|
| 77 |
+
For issues, feedback, or collaborations, feel free to reach out to [@yashsoni78](https://huggingface.co/yashsoni78).
|