Text Generation
Transformers
GGUF
PyTorch
English
python
java
cpp
sql
function calling
unit tests
causalLM
codeLLAMA modified archi
document
code
code2doc
instruction_tuned
basemodel
docstring
documentation
text-generation-inference
plan
planner
ggml
quantized
conversational
Instructions to use afrideva/pip-code-bandit-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use afrideva/pip-code-bandit-GGUF with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="afrideva/pip-code-bandit-GGUF") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("afrideva/pip-code-bandit-GGUF", dtype="auto") - llama-cpp-python
How to use afrideva/pip-code-bandit-GGUF with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="afrideva/pip-code-bandit-GGUF", filename="pip-code-bandit.Q2_K.gguf", )
llm.create_chat_completion( messages = [ { "role": "user", "content": "What is the capital of France?" } ] ) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use afrideva/pip-code-bandit-GGUF with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf afrideva/pip-code-bandit-GGUF:Q4_K_M # Run inference directly in the terminal: llama-cli -hf afrideva/pip-code-bandit-GGUF:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf afrideva/pip-code-bandit-GGUF:Q4_K_M # Run inference directly in the terminal: llama-cli -hf afrideva/pip-code-bandit-GGUF:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf afrideva/pip-code-bandit-GGUF:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf afrideva/pip-code-bandit-GGUF:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf afrideva/pip-code-bandit-GGUF:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf afrideva/pip-code-bandit-GGUF:Q4_K_M
Use Docker
docker model run hf.co/afrideva/pip-code-bandit-GGUF:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use afrideva/pip-code-bandit-GGUF with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "afrideva/pip-code-bandit-GGUF" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "afrideva/pip-code-bandit-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/afrideva/pip-code-bandit-GGUF:Q4_K_M
- SGLang
How to use afrideva/pip-code-bandit-GGUF 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 "afrideva/pip-code-bandit-GGUF" \ --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": "afrideva/pip-code-bandit-GGUF", "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 "afrideva/pip-code-bandit-GGUF" \ --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": "afrideva/pip-code-bandit-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use afrideva/pip-code-bandit-GGUF with Ollama:
ollama run hf.co/afrideva/pip-code-bandit-GGUF:Q4_K_M
- Unsloth Studio
How to use afrideva/pip-code-bandit-GGUF with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for afrideva/pip-code-bandit-GGUF to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for afrideva/pip-code-bandit-GGUF to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for afrideva/pip-code-bandit-GGUF to start chatting
- Atomic Chat new
- Docker Model Runner
How to use afrideva/pip-code-bandit-GGUF with Docker Model Runner:
docker model run hf.co/afrideva/pip-code-bandit-GGUF:Q4_K_M
- Lemonade
How to use afrideva/pip-code-bandit-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull afrideva/pip-code-bandit-GGUF:Q4_K_M
Run and chat with the model
lemonade run user.pip-code-bandit-GGUF-Q4_K_M
List all available models
lemonade list
Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,212 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
+
library_name: transformers
|
| 7 |
+
license: apache-2.0
|
| 8 |
+
metrics:
|
| 9 |
+
- accuracy
|
| 10 |
+
model_creator: PipableAI
|
| 11 |
+
model_name: pip-code-bandit
|
| 12 |
+
pipeline_tag: text-generation
|
| 13 |
+
quantized_by: afrideva
|
| 14 |
+
tags:
|
| 15 |
+
- python
|
| 16 |
+
- java
|
| 17 |
+
- cpp
|
| 18 |
+
- sql
|
| 19 |
+
- function calling
|
| 20 |
+
- unit tests
|
| 21 |
+
- causalLM
|
| 22 |
+
- codeLLAMA modified archi
|
| 23 |
+
- document
|
| 24 |
+
- code
|
| 25 |
+
- code2doc
|
| 26 |
+
- instruction_tuned
|
| 27 |
+
- basemodel
|
| 28 |
+
- pytorch
|
| 29 |
+
- docstring
|
| 30 |
+
- documentation
|
| 31 |
+
- text-generation-inference
|
| 32 |
+
- plan
|
| 33 |
+
- planner
|
| 34 |
+
- gguf
|
| 35 |
+
- ggml
|
| 36 |
+
- quantized
|
| 37 |
+
widget:
|
| 38 |
+
- example_title: example
|
| 39 |
+
text: '<example_response>--code:def function_divide2(x): return x / 2--question:Document
|
| 40 |
+
the code--doc:Description:This function takes a number and divides it by 2.Parameters:-
|
| 41 |
+
x (numeric): The input value to be divided by 2.Returns:- float: The result of
|
| 42 |
+
x divided by 2.Example:To call the function, use the following code:function_divide2(1.0)</example_response><function_code>def
|
| 43 |
+
_plot_bounding_polygon(polygons_coordinates, output_html_path=bounding_polygon_map.html):map_center
|
| 44 |
+
= [sum([coord[0]for polygon_coords in polygons_coordinatesfor coord in polygon_coords])/
|
| 45 |
+
sum([len(polygon_coords) for polygon_coords in polygons_coordinates]),sum([coord[1]for
|
| 46 |
+
polygon_coords in polygons_coordinatesfor coord in polygon_coords])/ sum([len(polygon_coords)
|
| 47 |
+
for polygon_coords in polygons_coordinates]),]my_map = folium.Map(location=map_center,
|
| 48 |
+
zoom_start=12)for polygon_coords in polygons_coordinates:folium.Polygon(locations=polygon_coords,color=blue,fill=True,fill_color=blue,fill_opacity=0.2,).add_to(my_map)marker_cluster
|
| 49 |
+
= MarkerCluster().add_to(my_map)for polygon_coords in polygons_coordinates:for
|
| 50 |
+
coord in polygon_coords:folium.Marker(location=[coord[0], coord[1]], popup=fCoordinates:
|
| 51 |
+
{coord}).add_to(marker_cluster)draw = Draw(export=True)draw.add_to(my_map)my_map.save(output_html_path)return
|
| 52 |
+
output_html_path</function_code><question>Document the python code above giving
|
| 53 |
+
function description ,parameters and return type and example how to call the function</question><doc>'
|
| 54 |
+
---
|
| 55 |
+
|
| 56 |
+
# pip-code-bandit-GGUF
|
| 57 |
+
|
| 58 |
+
Quantized GGUF model files for [pip-code-bandit](https://huggingface.co/PipableAI/pip-code-bandit) from [PipableAI](https://huggingface.co/PipableAI)
|
| 59 |
+
|
| 60 |
+
## Original Model Card:
|
| 61 |
+
|
| 62 |
+
# pip-code-bandit
|
| 63 |
+
|
| 64 |
+
[PipableAI](https://www.pipable.ai/)
|
| 65 |
+
|
| 66 |
+
[colab_notebook](https://colab.research.google.com/drive/10av3SxFf0Psx_IkmZbcUhiVznStV5pVS?usp=sharing)
|
| 67 |
+
|
| 68 |
+
[pipflow](https://github.com/PipableAI/pipflow)
|
| 69 |
+
|
| 70 |
+
[linkedin_post](https://www.linkedin.com/posts/pipable%2Eai_releasing-strategy-activity-7195750109886783489-tHrz?utm_source=share&utm_medium=member_desktop)
|
| 71 |
+
|
| 72 |
+
[reddit_post](https://www.reddit.com/r/LocalLLaMA/comments/1cqxdl9/unveiling_pipcodebandit_empowering_ai_in_agentic/?utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_button)
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
## Objective
|
| 76 |
+
|
| 77 |
+
|
| 78 |
+

|
| 79 |
+
|
| 80 |
+
|
| 81 |
+
Given a goal and tools, can AI intelligently use the tools to reach the goal?\
|
| 82 |
+
What if it has a meagre 1.3b params/neurons akin to that of an owl? Can it follow instructions and plan to reach a goal?\
|
| 83 |
+
It can!\
|
| 84 |
+
Releasing **pip-code-bandit** and **pipflow**\
|
| 85 |
+
A `model` and a `library` to manage and run goal-oriented agentic system.
|
| 86 |
+
|
| 87 |
+
|
| 88 |
+
## Model attributes
|
| 89 |
+
|
| 90 |
+
```javascript
|
| 91 |
+
-- number of params ~ 1.3b [2.9 Gb GPU memory footprint]
|
| 92 |
+
-- sequence length ~ 16.3k [Can go higher but will show performance degradation]
|
| 93 |
+
-- license - apache 2.0
|
| 94 |
+
-- instruction following , RL tuned.
|
| 95 |
+
-- tasks:
|
| 96 |
+
1. complex planning(plan) of sequential function calls | a list of callables and goal
|
| 97 |
+
2. corrected plan | feedback instructions with error
|
| 98 |
+
3. function calling | doc or code and goal
|
| 99 |
+
4. code generation | plan and goal
|
| 100 |
+
5. code generation | goal
|
| 101 |
+
6. doc generation | code
|
| 102 |
+
7. code generation | doc
|
| 103 |
+
8. file parsed to json | any raw data
|
| 104 |
+
9. sql generation | schema, question, instructions and examples
|
| 105 |
+
|
| 106 |
+
```
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
## How did we build it?
|
| 110 |
+
|
| 111 |
+
We used a simulator to simulate environments where the model could play games to achieve goals, given a set of actions available to it.
|
| 112 |
+
All the model could do was find the right action and config to incur a positive reward.
|
| 113 |
+
The reward policy is around the concept of a model going to a stable state of zero net sum reward for both good and bad behaviour.
|
| 114 |
+
In this setup, the model, which was pre-trained on code, function documentation, and similar OS datasets, was RL-tuned for reliability and instruction-following.
|
| 115 |
+
|
| 116 |
+
## License
|
| 117 |
+
```bash
|
| 118 |
+
complete open-sourced - apache 2.0. License
|
| 119 |
+
```
|
| 120 |
+
|
| 121 |
+
## Usage
|
| 122 |
+
|
| 123 |
+
|
| 124 |
+
### NOTE:
|
| 125 |
+
|
| 126 |
+
|
| 127 |
+
If you wish to try this model without utilizing your GPU, we have hosted the model on our end. To execute the library using the hosted model, initialize the generator as shown below:
|
| 128 |
+
|
| 129 |
+
```bash
|
| 130 |
+
pip3 install git+https://github.com/PipableAI/pipflow.git
|
| 131 |
+
```
|
| 132 |
+
```python
|
| 133 |
+
from pipflow import PipFlow
|
| 134 |
+
|
| 135 |
+
generator = PipFlow()
|
| 136 |
+
```
|
| 137 |
+
|
| 138 |
+
We have hosted the model at https://playground.pipable.ai/infer. Hence, one can also make a POST request to this endpoint with the following payload:
|
| 139 |
+
|
| 140 |
+
```json
|
| 141 |
+
{
|
| 142 |
+
"model_name": "PipableAI/pip-code-bandit",
|
| 143 |
+
"prompt": "prompt",
|
| 144 |
+
"max_new_tokens": "400"
|
| 145 |
+
}
|
| 146 |
+
```
|
| 147 |
+
|
| 148 |
+
```bash
|
| 149 |
+
curl -X 'POST' \
|
| 150 |
+
'https://playground.pipable.ai/infer' \
|
| 151 |
+
-H 'accept: application/json' \
|
| 152 |
+
-H 'Content-Type: application/x-www-form-urlencoded' \
|
| 153 |
+
-d 'model_name=PipableAI%2Fpip-code-bandit&prompt="YOUR PROMPT"&max_new_tokens=400'
|
| 154 |
+
```
|
| 155 |
+
|
| 156 |
+
Alternatively, you can directly access the UI endpoint at https://playground.pipable.ai/docs#/default/infer_infer_post.
|
| 157 |
+
|
| 158 |
+
|
| 159 |
+
|
| 160 |
+
### Library Usage
|
| 161 |
+
|
| 162 |
+
To directly use the model's capabilities without putting extra effort into schemas and prompts, try to use [pipflow](https://github.com/PipableAI/pipflow).
|
| 163 |
+
|
| 164 |
+
For detailed usage, refer to the [colab_notebook](https://colab.research.google.com/drive/10av3SxFf0Psx_IkmZbcUhiVznStV5pVS?usp=sharing)
|
| 165 |
+
|
| 166 |
+
|
| 167 |
+
|
| 168 |
+
### Model Usage
|
| 169 |
+
|
| 170 |
+
```bash
|
| 171 |
+
pip install transformers accelerate torch
|
| 172 |
+
```
|
| 173 |
+
|
| 174 |
+
```python
|
| 175 |
+
import torch
|
| 176 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 177 |
+
from accelerate import Accelerator
|
| 178 |
+
model =AutoModelForCausalLM.from_pretrained("PipableAI/pip-code-bandit",torch_dtype=torch.bfloat16,device_map="auto")
|
| 179 |
+
tokenizer = tokenizer = AutoTokenizer.from_pretrained("PipableAI/pip-code-bandit")
|
| 180 |
+
new_tokens = 600
|
| 181 |
+
prompt = """
|
| 182 |
+
<question>
|
| 183 |
+
Generate a python function for adding two numbers.
|
| 184 |
+
</question>
|
| 185 |
+
<code>
|
| 186 |
+
"""
|
| 187 |
+
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
|
| 188 |
+
outputs = model.generate(**inputs, max_new_tokens=new_tokens)
|
| 189 |
+
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 190 |
+
response = response.split("<code>")[1].split("</code>")[0]
|
| 191 |
+
|
| 192 |
+
print(response)
|
| 193 |
+
```
|
| 194 |
+
|
| 195 |
+
|
| 196 |
+
### Prompt
|
| 197 |
+
|
| 198 |
+
```python
|
| 199 |
+
prompt = f"""<example_response>{--question , --query}</example_response><function_code>{code}</function_code>
|
| 200 |
+
<question>Give one line description of the python code above in natural language.</question>
|
| 201 |
+
<doc>"""
|
| 202 |
+
|
| 203 |
+
prompt = f"""<example_response>{example of some --question: , --query}</example_response><schema>{schema with cols described}</schema>
|
| 204 |
+
<question>Write a sql query to ....</question>
|
| 205 |
+
<sql>"""
|
| 206 |
+
```
|
| 207 |
+
|
| 208 |
+
### Team
|
| 209 |
+
|
| 210 |
+
```doc
|
| 211 |
+
Avi Kothari, Gyan Ranjan, Pratham Gupta, Ritvik Aryan Kalra, Soham Acharya
|
| 212 |
+
```
|