Instructions to use macadeliccc/piccolo-4x7b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use macadeliccc/piccolo-4x7b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="macadeliccc/piccolo-4x7b")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("macadeliccc/piccolo-4x7b") model = AutoModelForCausalLM.from_pretrained("macadeliccc/piccolo-4x7b", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use macadeliccc/piccolo-4x7b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "macadeliccc/piccolo-4x7b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "macadeliccc/piccolo-4x7b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/macadeliccc/piccolo-4x7b
- SGLang
How to use macadeliccc/piccolo-4x7b 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 "macadeliccc/piccolo-4x7b" \ --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": "macadeliccc/piccolo-4x7b", "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 "macadeliccc/piccolo-4x7b" \ --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": "macadeliccc/piccolo-4x7b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use macadeliccc/piccolo-4x7b with Docker Model Runner:
docker model run hf.co/macadeliccc/piccolo-4x7b
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,51 @@
|
|
| 1 |
---
|
| 2 |
-
license: cc-by-
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
license: cc-by-4.0
|
| 3 |
---
|
| 4 |
+
# Piccolo-8x7b
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
**In loving memory of my dog Klaus (Piccolo)**
|
| 8 |
+
|
| 9 |
+
_~ Piccolo (Italian): the little one ~_
|
| 10 |
+
|
| 11 |
+

|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
# Code Example
|
| 15 |
+
|
| 16 |
+
Inference and Evaluation colab available [here](https://colab.research.google.com/drive/1ZqLNvVvtFHC_4v2CgcMVh7pP9Fvx0SbI?usp=sharing)
|
| 17 |
+
|
| 18 |
+
```python
|
| 19 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 20 |
+
|
| 21 |
+
def generate_response(prompt):
|
| 22 |
+
"""
|
| 23 |
+
Generate a response from the model based on the input prompt.
|
| 24 |
+
Args:
|
| 25 |
+
prompt (str): Prompt for the model.
|
| 26 |
+
|
| 27 |
+
Returns:
|
| 28 |
+
str: The generated response from the model.
|
| 29 |
+
"""
|
| 30 |
+
inputs = tokenizer(prompt, return_tensors="pt")
|
| 31 |
+
outputs = model.generate(**inputs, max_new_tokens=256, eos_token_id=tokenizer.eos_token_id, pad_token_id=tokenizer.pad_token_id)
|
| 32 |
+
|
| 33 |
+
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 34 |
+
|
| 35 |
+
return response
|
| 36 |
+
|
| 37 |
+
model_id = "macadeliccc/Piccolo-8x7b"
|
| 38 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 39 |
+
model = AutoModelForCausalLM.from_pretrained(model_id,load_in_4bit=True)
|
| 40 |
+
|
| 41 |
+
prompt = "What is the best way to train Cane Corsos?"
|
| 42 |
+
|
| 43 |
+
print("Response:")
|
| 44 |
+
print(generate_response(prompt), "\n")
|
| 45 |
+
```
|
| 46 |
+
|
| 47 |
+
The model is capable of quality code, math, and logical reasoning. Try whatever questions you think of.
|
| 48 |
+
|
| 49 |
+
# Evaluations
|
| 50 |
+
|
| 51 |
+
TODO
|