Text Generation
Transformers
TensorBoard
Safetensors
llama
TinyLlama
Medical Bot
conversational
text-generation-inference
Instructions to use mananshah296/medbot with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use mananshah296/medbot with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="mananshah296/medbot") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("mananshah296/medbot") model = AutoModelForCausalLM.from_pretrained("mananshah296/medbot") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use mananshah296/medbot with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "mananshah296/medbot" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mananshah296/medbot", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/mananshah296/medbot
- SGLang
How to use mananshah296/medbot 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 "mananshah296/medbot" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mananshah296/medbot", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "mananshah296/medbot" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mananshah296/medbot", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use mananshah296/medbot with Docker Model Runner:
docker model run hf.co/mananshah296/medbot
Upload folder using huggingface_hub
Browse files- README.md +46 -0
- adapter_config.json +37 -0
- adapter_model.safetensors +3 -0
- runs/Apr30_14-46-24_d7f1501a4261/events.out.tfevents.1746024393.d7f1501a4261.542.0 +2 -2
- special_tokens_map.json +30 -0
- tokenizer.json +0 -0
- tokenizer.model +3 -0
- tokenizer_config.json +44 -0
- training_args.bin +3 -0
- training_params.json +49 -0
README.md
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
tags:
|
| 3 |
+
- autotrain
|
| 4 |
+
- text-generation-inference
|
| 5 |
+
- text-generation
|
| 6 |
+
- peft
|
| 7 |
+
library_name: transformers
|
| 8 |
+
base_model: TinyLlama/TinyLlama-1.1B-Chat-v1.0
|
| 9 |
+
widget:
|
| 10 |
+
- messages:
|
| 11 |
+
- role: user
|
| 12 |
+
content: What is your favorite condiment?
|
| 13 |
+
license: other
|
| 14 |
+
---
|
| 15 |
+
|
| 16 |
+
# Model Trained Using AutoTrain
|
| 17 |
+
|
| 18 |
+
This model was trained using AutoTrain. For more information, please visit [AutoTrain](https://hf.co/docs/autotrain).
|
| 19 |
+
|
| 20 |
+
# Usage
|
| 21 |
+
|
| 22 |
+
```python
|
| 23 |
+
|
| 24 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 25 |
+
|
| 26 |
+
model_path = "PATH_TO_THIS_REPO"
|
| 27 |
+
|
| 28 |
+
tokenizer = AutoTokenizer.from_pretrained(model_path)
|
| 29 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 30 |
+
model_path,
|
| 31 |
+
device_map="auto",
|
| 32 |
+
torch_dtype='auto'
|
| 33 |
+
).eval()
|
| 34 |
+
|
| 35 |
+
# Prompt content: "hi"
|
| 36 |
+
messages = [
|
| 37 |
+
{"role": "user", "content": "hi"}
|
| 38 |
+
]
|
| 39 |
+
|
| 40 |
+
input_ids = tokenizer.apply_chat_template(conversation=messages, tokenize=True, add_generation_prompt=True, return_tensors='pt')
|
| 41 |
+
output_ids = model.generate(input_ids.to('cuda'))
|
| 42 |
+
response = tokenizer.decode(output_ids[0][input_ids.shape[1]:], skip_special_tokens=True)
|
| 43 |
+
|
| 44 |
+
# Model response: "Hello! How can I assist you today?"
|
| 45 |
+
print(response)
|
| 46 |
+
```
|
adapter_config.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"alpha_pattern": {},
|
| 3 |
+
"auto_mapping": null,
|
| 4 |
+
"base_model_name_or_path": "TinyLlama/TinyLlama-1.1B-Chat-v1.0",
|
| 5 |
+
"bias": "none",
|
| 6 |
+
"eva_config": null,
|
| 7 |
+
"exclude_modules": null,
|
| 8 |
+
"fan_in_fan_out": false,
|
| 9 |
+
"inference_mode": true,
|
| 10 |
+
"init_lora_weights": true,
|
| 11 |
+
"layer_replication": null,
|
| 12 |
+
"layers_pattern": null,
|
| 13 |
+
"layers_to_transform": null,
|
| 14 |
+
"loftq_config": {},
|
| 15 |
+
"lora_alpha": 16,
|
| 16 |
+
"lora_bias": false,
|
| 17 |
+
"lora_dropout": 0.05,
|
| 18 |
+
"megatron_config": null,
|
| 19 |
+
"megatron_core": "megatron.core",
|
| 20 |
+
"modules_to_save": null,
|
| 21 |
+
"peft_type": "LORA",
|
| 22 |
+
"r": 4,
|
| 23 |
+
"rank_pattern": {},
|
| 24 |
+
"revision": null,
|
| 25 |
+
"target_modules": [
|
| 26 |
+
"down_proj",
|
| 27 |
+
"up_proj",
|
| 28 |
+
"gate_proj",
|
| 29 |
+
"v_proj",
|
| 30 |
+
"k_proj",
|
| 31 |
+
"q_proj",
|
| 32 |
+
"o_proj"
|
| 33 |
+
],
|
| 34 |
+
"task_type": "CAUSAL_LM",
|
| 35 |
+
"use_dora": false,
|
| 36 |
+
"use_rslora": false
|
| 37 |
+
}
|
adapter_model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4ed68c53c52b48c0d548928cf39f34a950c88a14afb29b5590ec5947c319a1f2
|
| 3 |
+
size 12655792
|
runs/Apr30_14-46-24_d7f1501a4261/events.out.tfevents.1746024393.d7f1501a4261.542.0
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:01649f8574154161119e8e9a01f64fb0100ff998fcc196fc90d70f9b1a2af4de
|
| 3 |
+
size 13785
|
special_tokens_map.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token": {
|
| 3 |
+
"content": "<s>",
|
| 4 |
+
"lstrip": false,
|
| 5 |
+
"normalized": false,
|
| 6 |
+
"rstrip": false,
|
| 7 |
+
"single_word": false
|
| 8 |
+
},
|
| 9 |
+
"eos_token": {
|
| 10 |
+
"content": "</s>",
|
| 11 |
+
"lstrip": false,
|
| 12 |
+
"normalized": false,
|
| 13 |
+
"rstrip": false,
|
| 14 |
+
"single_word": false
|
| 15 |
+
},
|
| 16 |
+
"pad_token": {
|
| 17 |
+
"content": "</s>",
|
| 18 |
+
"lstrip": false,
|
| 19 |
+
"normalized": false,
|
| 20 |
+
"rstrip": false,
|
| 21 |
+
"single_word": false
|
| 22 |
+
},
|
| 23 |
+
"unk_token": {
|
| 24 |
+
"content": "<unk>",
|
| 25 |
+
"lstrip": false,
|
| 26 |
+
"normalized": false,
|
| 27 |
+
"rstrip": false,
|
| 28 |
+
"single_word": false
|
| 29 |
+
}
|
| 30 |
+
}
|
tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer.model
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9e556afd44213b6bd1be2b850ebbbd98f5481437a8021afaf58ee7fb1818d347
|
| 3 |
+
size 499723
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_bos_token": true,
|
| 3 |
+
"add_eos_token": false,
|
| 4 |
+
"add_prefix_space": null,
|
| 5 |
+
"added_tokens_decoder": {
|
| 6 |
+
"0": {
|
| 7 |
+
"content": "<unk>",
|
| 8 |
+
"lstrip": false,
|
| 9 |
+
"normalized": false,
|
| 10 |
+
"rstrip": false,
|
| 11 |
+
"single_word": false,
|
| 12 |
+
"special": true
|
| 13 |
+
},
|
| 14 |
+
"1": {
|
| 15 |
+
"content": "<s>",
|
| 16 |
+
"lstrip": false,
|
| 17 |
+
"normalized": false,
|
| 18 |
+
"rstrip": false,
|
| 19 |
+
"single_word": false,
|
| 20 |
+
"special": true
|
| 21 |
+
},
|
| 22 |
+
"2": {
|
| 23 |
+
"content": "</s>",
|
| 24 |
+
"lstrip": false,
|
| 25 |
+
"normalized": false,
|
| 26 |
+
"rstrip": false,
|
| 27 |
+
"single_word": false,
|
| 28 |
+
"special": true
|
| 29 |
+
}
|
| 30 |
+
},
|
| 31 |
+
"bos_token": "<s>",
|
| 32 |
+
"chat_template": "{% for message in messages %}\n{% if message['role'] == 'user' %}\n{{ '<|user|>\n' + message['content'] + eos_token }}\n{% elif message['role'] == 'system' %}\n{{ '<|system|>\n' + message['content'] + eos_token }}\n{% elif message['role'] == 'assistant' %}\n{{ '<|assistant|>\n' + message['content'] + eos_token }}\n{% endif %}\n{% if loop.last and add_generation_prompt %}\n{{ '<|assistant|>' }}\n{% endif %}\n{% endfor %}",
|
| 33 |
+
"clean_up_tokenization_spaces": false,
|
| 34 |
+
"eos_token": "</s>",
|
| 35 |
+
"extra_special_tokens": {},
|
| 36 |
+
"legacy": false,
|
| 37 |
+
"model_max_length": 2048,
|
| 38 |
+
"pad_token": "</s>",
|
| 39 |
+
"padding_side": "right",
|
| 40 |
+
"sp_model_kwargs": {},
|
| 41 |
+
"tokenizer_class": "LlamaTokenizer",
|
| 42 |
+
"unk_token": "<unk>",
|
| 43 |
+
"use_default_system_prompt": false
|
| 44 |
+
}
|
training_args.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:aa8fec0b39066cede6082108841ec869cb341626af0f7d791c8489752c954557
|
| 3 |
+
size 5560
|
training_params.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model": "TinyLlama/TinyLlama-1.1B-Chat-v1.0",
|
| 3 |
+
"project_name": "medbot",
|
| 4 |
+
"data_path": "medbot/autotrain-data",
|
| 5 |
+
"train_split": "train",
|
| 6 |
+
"valid_split": null,
|
| 7 |
+
"add_eos_token": true,
|
| 8 |
+
"block_size": 1024,
|
| 9 |
+
"model_max_length": 2048,
|
| 10 |
+
"padding": "right",
|
| 11 |
+
"trainer": "sft",
|
| 12 |
+
"use_flash_attention_2": false,
|
| 13 |
+
"log": "tensorboard",
|
| 14 |
+
"disable_gradient_checkpointing": false,
|
| 15 |
+
"logging_steps": -1,
|
| 16 |
+
"eval_strategy": "epoch",
|
| 17 |
+
"save_total_limit": 1,
|
| 18 |
+
"auto_find_batch_size": false,
|
| 19 |
+
"mixed_precision": "no",
|
| 20 |
+
"lr": 2e-05,
|
| 21 |
+
"epochs": 5,
|
| 22 |
+
"batch_size": 2,
|
| 23 |
+
"warmup_ratio": 0.1,
|
| 24 |
+
"gradient_accumulation": 1,
|
| 25 |
+
"optimizer": "adamw_torch",
|
| 26 |
+
"scheduler": "linear",
|
| 27 |
+
"weight_decay": 0.01,
|
| 28 |
+
"max_grad_norm": 1.0,
|
| 29 |
+
"seed": 42,
|
| 30 |
+
"chat_template": null,
|
| 31 |
+
"quantization": "none",
|
| 32 |
+
"target_modules": "all-linear",
|
| 33 |
+
"merge_adapter": false,
|
| 34 |
+
"peft": true,
|
| 35 |
+
"lora_r": 4,
|
| 36 |
+
"lora_alpha": 16,
|
| 37 |
+
"lora_dropout": 0.05,
|
| 38 |
+
"model_ref": null,
|
| 39 |
+
"dpo_beta": 0.1,
|
| 40 |
+
"max_prompt_length": 128,
|
| 41 |
+
"max_completion_length": null,
|
| 42 |
+
"prompt_text_column": "autotrain_prompt",
|
| 43 |
+
"text_column": "autotrain_text",
|
| 44 |
+
"rejected_text_column": "autotrain_rejected_text",
|
| 45 |
+
"push_to_hub": true,
|
| 46 |
+
"username": "mananshah296",
|
| 47 |
+
"unsloth": false,
|
| 48 |
+
"distributed_backend": null
|
| 49 |
+
}
|