Instructions to use SirWumpus/hybridModel with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use SirWumpus/hybridModel with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="SirWumpus/hybridModel")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("SirWumpus/hybridModel") model = AutoModelForCausalLM.from_pretrained("SirWumpus/hybridModel", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use SirWumpus/hybridModel with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "SirWumpus/hybridModel" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "SirWumpus/hybridModel", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/SirWumpus/hybridModel
- SGLang
How to use SirWumpus/hybridModel 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 "SirWumpus/hybridModel" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "SirWumpus/hybridModel", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "SirWumpus/hybridModel" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "SirWumpus/hybridModel", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use SirWumpus/hybridModel with Docker Model Runner:
docker model run hf.co/SirWumpus/hybridModel
| import torch | |
| from transformers import AutoModelForCausalLM, AutoTokenizer, AutoConfig | |
| # Load base model | |
| base_model_name = "NousResearch/Llama-2-13b-hf" | |
| base_model = AutoModelForCausalLM.from_pretrained(base_model_name) | |
| tokenizer = AutoTokenizer.from_pretrained(base_model_name) | |
| # Load LoRA weights | |
| lora_model_name = "FinGPT/fingpt-sentiment_llama2-13b_lora" | |
| lora_model = AutoModelForCausalLM.from_pretrained(lora_model_name) | |
| # Apply LoRA weights to the base model | |
| def apply_lora_weights(base_model, lora_model): | |
| base_model_state_dict = base_model.state_dict() | |
| lora_model_state_dict = lora_model.state_dict() | |
| for name, param in lora_model_state_dict.items(): | |
| if name in base_model_state_dict: | |
| base_model_state_dict[name].copy_(param) | |
| base_model.load_state_dict(base_model_state_dict) | |
| apply_lora_weights(base_model, lora_model) | |
| # Save the merged model | |
| output_dir = "./hybrid_model" | |
| base_model.save_pretrained(output_dir) | |
| tokenizer.save_pretrained(output_dir) | |