Instructions to use kentridge/med_chatbot with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use kentridge/med_chatbot with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="kentridge/med_chatbot") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("kentridge/med_chatbot") model = AutoModelForCausalLM.from_pretrained("kentridge/med_chatbot", device_map="auto") 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 kentridge/med_chatbot with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "kentridge/med_chatbot" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "kentridge/med_chatbot", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/kentridge/med_chatbot
- SGLang
How to use kentridge/med_chatbot 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 "kentridge/med_chatbot" \ --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": "kentridge/med_chatbot", "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 "kentridge/med_chatbot" \ --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": "kentridge/med_chatbot", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use kentridge/med_chatbot with Docker Model Runner:
docker model run hf.co/kentridge/med_chatbot
Upload LlamaForCausalLM
#3
by Lucifer049 - opened
- README.md +3 -1
- config.json +38 -16
- generation_config.json +9 -5
- model.safetensors +3 -0
README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
| 1 |
---
|
| 2 |
library_name: transformers
|
| 3 |
-
tags:
|
|
|
|
|
|
|
| 4 |
---
|
| 5 |
|
| 6 |
# Model Card for Model ID
|
|
|
|
| 1 |
---
|
| 2 |
library_name: transformers
|
| 3 |
+
tags:
|
| 4 |
+
- trl
|
| 5 |
+
- sft
|
| 6 |
---
|
| 7 |
|
| 8 |
# Model Card for Model ID
|
config.json
CHANGED
|
@@ -1,29 +1,51 @@
|
|
| 1 |
{
|
| 2 |
-
"_name_or_path": "meta-llama/Llama-2-7b-chat-hf",
|
| 3 |
"architectures": [
|
| 4 |
"LlamaForCausalLM"
|
| 5 |
],
|
| 6 |
"attention_bias": false,
|
| 7 |
"attention_dropout": 0.0,
|
| 8 |
-
"bos_token_id":
|
| 9 |
-
"
|
|
|
|
|
|
|
| 10 |
"hidden_act": "silu",
|
| 11 |
-
"hidden_size":
|
| 12 |
"initializer_range": 0.02,
|
| 13 |
-
"intermediate_size":
|
| 14 |
-
"max_position_embeddings":
|
| 15 |
"mlp_bias": false,
|
| 16 |
"model_type": "llama",
|
| 17 |
-
"num_attention_heads":
|
| 18 |
-
"num_hidden_layers":
|
| 19 |
-
"num_key_value_heads":
|
|
|
|
| 20 |
"pretraining_tp": 1,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
"rms_norm_eps": 1e-05,
|
| 22 |
-
"
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
}
|
|
|
|
| 1 |
{
|
|
|
|
| 2 |
"architectures": [
|
| 3 |
"LlamaForCausalLM"
|
| 4 |
],
|
| 5 |
"attention_bias": false,
|
| 6 |
"attention_dropout": 0.0,
|
| 7 |
+
"bos_token_id": 128000,
|
| 8 |
+
"dtype": "float16",
|
| 9 |
+
"eos_token_id": 128009,
|
| 10 |
+
"head_dim": 128,
|
| 11 |
"hidden_act": "silu",
|
| 12 |
+
"hidden_size": 3072,
|
| 13 |
"initializer_range": 0.02,
|
| 14 |
+
"intermediate_size": 8192,
|
| 15 |
+
"max_position_embeddings": 131072,
|
| 16 |
"mlp_bias": false,
|
| 17 |
"model_type": "llama",
|
| 18 |
+
"num_attention_heads": 24,
|
| 19 |
+
"num_hidden_layers": 28,
|
| 20 |
+
"num_key_value_heads": 8,
|
| 21 |
+
"pad_token_id": 128009,
|
| 22 |
"pretraining_tp": 1,
|
| 23 |
+
"quantization_config": {
|
| 24 |
+
"_load_in_4bit": true,
|
| 25 |
+
"_load_in_8bit": false,
|
| 26 |
+
"bnb_4bit_compute_dtype": "float16",
|
| 27 |
+
"bnb_4bit_quant_storage": "uint8",
|
| 28 |
+
"bnb_4bit_quant_type": "nf4",
|
| 29 |
+
"bnb_4bit_use_double_quant": false,
|
| 30 |
+
"llm_int8_enable_fp32_cpu_offload": false,
|
| 31 |
+
"llm_int8_has_fp16_weight": false,
|
| 32 |
+
"llm_int8_skip_modules": null,
|
| 33 |
+
"llm_int8_threshold": 6.0,
|
| 34 |
+
"load_in_4bit": true,
|
| 35 |
+
"load_in_8bit": false,
|
| 36 |
+
"quant_method": "bitsandbytes"
|
| 37 |
+
},
|
| 38 |
"rms_norm_eps": 1e-05,
|
| 39 |
+
"rope_parameters": {
|
| 40 |
+
"factor": 32.0,
|
| 41 |
+
"high_freq_factor": 4.0,
|
| 42 |
+
"low_freq_factor": 1.0,
|
| 43 |
+
"original_max_position_embeddings": 8192,
|
| 44 |
+
"rope_theta": 500000.0,
|
| 45 |
+
"rope_type": "llama3"
|
| 46 |
+
},
|
| 47 |
+
"tie_word_embeddings": true,
|
| 48 |
+
"transformers_version": "5.3.0",
|
| 49 |
+
"use_cache": false,
|
| 50 |
+
"vocab_size": 128256
|
| 51 |
}
|
generation_config.json
CHANGED
|
@@ -1,10 +1,14 @@
|
|
| 1 |
{
|
| 2 |
-
"bos_token_id":
|
| 3 |
"do_sample": true,
|
| 4 |
-
"eos_token_id":
|
| 5 |
-
|
| 6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
"temperature": 0.6,
|
| 8 |
"top_p": 0.9,
|
| 9 |
-
"transformers_version": "
|
| 10 |
}
|
|
|
|
| 1 |
{
|
| 2 |
+
"bos_token_id": 128000,
|
| 3 |
"do_sample": true,
|
| 4 |
+
"eos_token_id": [
|
| 5 |
+
128009,
|
| 6 |
+
128001,
|
| 7 |
+
128008,
|
| 8 |
+
128009
|
| 9 |
+
],
|
| 10 |
+
"pad_token_id": 128009,
|
| 11 |
"temperature": 0.6,
|
| 12 |
"top_p": 0.9,
|
| 13 |
+
"transformers_version": "5.3.0"
|
| 14 |
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a4d270ea4b2ab0ab154472768dfcf0458f9990108b27d731a374b058b16b518b
|
| 3 |
+
size 2410648588
|