Text Generation
Transformers
Safetensors
Portuguese
sft
phi3
portuguese
health
offline-llm
lora
conversational
Instructions to use admin-lima/phi35-saude-amazonia-lora with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use admin-lima/phi35-saude-amazonia-lora with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="admin-lima/phi35-saude-amazonia-lora") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("admin-lima/phi35-saude-amazonia-lora", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use admin-lima/phi35-saude-amazonia-lora with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "admin-lima/phi35-saude-amazonia-lora" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "admin-lima/phi35-saude-amazonia-lora", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/admin-lima/phi35-saude-amazonia-lora
- SGLang
How to use admin-lima/phi35-saude-amazonia-lora 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 "admin-lima/phi35-saude-amazonia-lora" \ --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": "admin-lima/phi35-saude-amazonia-lora", "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 "admin-lima/phi35-saude-amazonia-lora" \ --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": "admin-lima/phi35-saude-amazonia-lora", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use admin-lima/phi35-saude-amazonia-lora with Docker Model Runner:
docker model run hf.co/admin-lima/phi35-saude-amazonia-lora
| language: | |
| - pt | |
| library_name: peft | |
| base_model: microsoft/Phi-3.5-mini-instruct | |
| license: mit | |
| tags: | |
| - health | |
| - clinical | |
| - amazonia | |
| - qlora | |
| - rag | |
| - sus | |
| - portuguese | |
| - offline | |
| # Phi-3.5-mini: Assistente Clínico Offline da Amazônia | |
| Adapter **LoRA (QLoRA 4-bit)** sobre `microsoft/Phi-3.5-mini-instruct` (3,8B), fine-tunado em 1.000 diálogos clínicos sintéticos em português brasileiro. | |
| ## Configuração do treino | |
| | Parâmetro | Valor | | |
| |---|---| | |
| | Modelo base | microsoft/Phi-3.5-mini-instruct (3,8B) | | |
| | Quantização | 4-bit NF4 (QLoRA) | | |
| | LoRA targets | qkv_proj, o_proj | | |
| | LoRA r / alpha | 16 / 32 | | |
| | Épocas | 3 | | |
| | Learning rate | 2e-4 (cosine) | | |
| | Dataset | admin-lima/sllm-amazonia-saude-sft (1000 exemplos) | | |
| ## Resultados (hold-out n=33) | |
| | Métrica | Valor | | |
| |---|---| | |
| | **TRR (recusa correta)** | **0.929** | | |
| | FRR (falsa recusa) | 0.266 | | |
| | F1 (recusa) | 0.813 | | |
| | Dosage-Hallucination | 0.03 | | |
| ## Uso | |
| ```python | |
| from peft import PeftModel | |
| from transformers import AutoModelForCausalLM, AutoTokenizer | |
| base = "microsoft/Phi-3.5-mini-instruct" | |
| adapter = "admin-lima/phi35-saude-amazonia-lora" | |
| tok = AutoTokenizer.from_pretrained(base, trust_remote_code=True) | |
| model = AutoModelForCausalLM.from_pretrained(base, torch_dtype="float16", | |
| trust_remote_code=True, device_map="auto") | |
| model = PeftModel.from_pretrained(model, adapter) | |
| ``` | |
| ## Aviso | |
| O sistema **apoia** a decisão do profissional; não a substitui. | |