Instructions to use openaccess-ai-collective/mighty-llama-1b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use openaccess-ai-collective/mighty-llama-1b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="openaccess-ai-collective/mighty-llama-1b", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("openaccess-ai-collective/mighty-llama-1b", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use openaccess-ai-collective/mighty-llama-1b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "openaccess-ai-collective/mighty-llama-1b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "openaccess-ai-collective/mighty-llama-1b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/openaccess-ai-collective/mighty-llama-1b
- SGLang
How to use openaccess-ai-collective/mighty-llama-1b 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 "openaccess-ai-collective/mighty-llama-1b" \ --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": "openaccess-ai-collective/mighty-llama-1b", "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 "openaccess-ai-collective/mighty-llama-1b" \ --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": "openaccess-ai-collective/mighty-llama-1b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use openaccess-ai-collective/mighty-llama-1b with Docker Model Runner:
docker model run hf.co/openaccess-ai-collective/mighty-llama-1b
Update modeling_llama.py
Browse files- modeling_llama.py +1 -1
modeling_llama.py
CHANGED
|
@@ -91,7 +91,7 @@ class MightyLlamaModel(LlamaModel):
|
|
| 91 |
all_self_attns = () if output_attentions else None
|
| 92 |
next_decoder_cache = None
|
| 93 |
|
| 94 |
-
layer_order = list(range(0, 3)) + [x for _ in range(
|
| 95 |
for idx, layer_idx in enumerate(layer_order):
|
| 96 |
decoder_layer = self.layers[layer_idx]
|
| 97 |
if output_hidden_states:
|
|
|
|
| 91 |
all_self_attns = () if output_attentions else None
|
| 92 |
next_decoder_cache = None
|
| 93 |
|
| 94 |
+
layer_order = list(range(0, 3)) + [x for _ in range(16) for x in range(4, 17)] + list(range(18, len(self.layers)))
|
| 95 |
for idx, layer_idx in enumerate(layer_order):
|
| 96 |
decoder_layer = self.layers[layer_idx]
|
| 97 |
if output_hidden_states:
|