Text Generation
Transformers
Safetensors
OpenVINO
llama
code
granite
openvino-export
conversational
Eval Results (legacy)
text-generation-inference
Instructions to use NitroLLM/granite-8b-code-instruct-4k-openvino with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use NitroLLM/granite-8b-code-instruct-4k-openvino with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="NitroLLM/granite-8b-code-instruct-4k-openvino", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("NitroLLM/granite-8b-code-instruct-4k-openvino") model = AutoModelForCausalLM.from_pretrained("NitroLLM/granite-8b-code-instruct-4k-openvino", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use NitroLLM/granite-8b-code-instruct-4k-openvino with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "NitroLLM/granite-8b-code-instruct-4k-openvino" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "NitroLLM/granite-8b-code-instruct-4k-openvino", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/NitroLLM/granite-8b-code-instruct-4k-openvino
- SGLang
How to use NitroLLM/granite-8b-code-instruct-4k-openvino 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 "NitroLLM/granite-8b-code-instruct-4k-openvino" \ --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": "NitroLLM/granite-8b-code-instruct-4k-openvino", "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 "NitroLLM/granite-8b-code-instruct-4k-openvino" \ --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": "NitroLLM/granite-8b-code-instruct-4k-openvino", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use NitroLLM/granite-8b-code-instruct-4k-openvino with Docker Model Runner:
docker model run hf.co/NitroLLM/granite-8b-code-instruct-4k-openvino
Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
pipeline_tag: text-generation
|
| 3 |
+
base_model: ibm-granite/granite-8b-code-instruct-4k
|
| 4 |
+
inference: false
|
| 5 |
+
license: apache-2.0
|
| 6 |
+
datasets:
|
| 7 |
+
- bigcode/commitpackft
|
| 8 |
+
- TIGER-Lab/MathInstruct
|
| 9 |
+
- meta-math/MetaMathQA
|
| 10 |
+
- glaiveai/glaive-code-assistant-v3
|
| 11 |
+
- glaive-function-calling-v2
|
| 12 |
+
- bugdaryan/sql-create-context-instruction
|
| 13 |
+
- garage-bAInd/Open-Platypus
|
| 14 |
+
- nvidia/HelpSteer
|
| 15 |
+
metrics:
|
| 16 |
+
- code_eval
|
| 17 |
+
library_name: transformers
|
| 18 |
+
tags:
|
| 19 |
+
- code
|
| 20 |
+
- granite
|
| 21 |
+
- openvino
|
| 22 |
+
- openvino-export
|
| 23 |
+
model-index:
|
| 24 |
+
- name: granite-8b-code-instruct-4k
|
| 25 |
+
results:
|
| 26 |
+
- task:
|
| 27 |
+
type: text-generation
|
| 28 |
+
dataset:
|
| 29 |
+
name: HumanEvalSynthesis(Python)
|
| 30 |
+
type: bigcode/humanevalpack
|
| 31 |
+
metrics:
|
| 32 |
+
- type: pass@1
|
| 33 |
+
value: 57.9
|
| 34 |
+
name: pass@1
|
| 35 |
+
- type: pass@1
|
| 36 |
+
value: 52.4
|
| 37 |
+
name: pass@1
|
| 38 |
+
- type: pass@1
|
| 39 |
+
value: 58.5
|
| 40 |
+
name: pass@1
|
| 41 |
+
- type: pass@1
|
| 42 |
+
value: 43.3
|
| 43 |
+
name: pass@1
|
| 44 |
+
- type: pass@1
|
| 45 |
+
value: 48.2
|
| 46 |
+
name: pass@1
|
| 47 |
+
- type: pass@1
|
| 48 |
+
value: 37.2
|
| 49 |
+
name: pass@1
|
| 50 |
+
- type: pass@1
|
| 51 |
+
value: 53.0
|
| 52 |
+
name: pass@1
|
| 53 |
+
- type: pass@1
|
| 54 |
+
value: 42.7
|
| 55 |
+
name: pass@1
|
| 56 |
+
- type: pass@1
|
| 57 |
+
value: 52.4
|
| 58 |
+
name: pass@1
|
| 59 |
+
- type: pass@1
|
| 60 |
+
value: 36.6
|
| 61 |
+
name: pass@1
|
| 62 |
+
- type: pass@1
|
| 63 |
+
value: 43.9
|
| 64 |
+
name: pass@1
|
| 65 |
+
- type: pass@1
|
| 66 |
+
value: 16.5
|
| 67 |
+
name: pass@1
|
| 68 |
+
- type: pass@1
|
| 69 |
+
value: 39.6
|
| 70 |
+
name: pass@1
|
| 71 |
+
- type: pass@1
|
| 72 |
+
value: 40.9
|
| 73 |
+
name: pass@1
|
| 74 |
+
- type: pass@1
|
| 75 |
+
value: 48.2
|
| 76 |
+
name: pass@1
|
| 77 |
+
- type: pass@1
|
| 78 |
+
value: 41.5
|
| 79 |
+
name: pass@1
|
| 80 |
+
- type: pass@1
|
| 81 |
+
value: 39.0
|
| 82 |
+
name: pass@1
|
| 83 |
+
- type: pass@1
|
| 84 |
+
value: 32.9
|
| 85 |
+
name: pass@1
|
| 86 |
+
---
|
| 87 |
+
|
| 88 |
+
This model was converted to OpenVINO from [`ibm-granite/granite-8b-code-instruct-4k`](https://huggingface.co/ibm-granite/granite-8b-code-instruct-4k) using [optimum-intel](https://github.com/huggingface/optimum-intel)
|
| 89 |
+
via the [export](https://huggingface.co/spaces/echarlaix/openvino-export) space.
|
| 90 |
+
|
| 91 |
+
First make sure you have optimum-intel installed:
|
| 92 |
+
|
| 93 |
+
```bash
|
| 94 |
+
pip install optimum[openvino]
|
| 95 |
+
```
|
| 96 |
+
|
| 97 |
+
To load your model you can do as follows:
|
| 98 |
+
|
| 99 |
+
```python
|
| 100 |
+
from optimum.intel import OVModelForCausalLM
|
| 101 |
+
|
| 102 |
+
model_id = "NitroLLM/granite-8b-code-instruct-4k-openvino"
|
| 103 |
+
model = OVModelForCausalLM.from_pretrained(model_id)
|
| 104 |
+
```
|