Granite-8B-Code-Instruct-4K
is a 8B parameter model fine tuned from
Granite-8B-Code-Base-4K
on a combination of
permissively licensed
instruction data to enhance instruction following capabilities including logical reasoning and problem-solving skills.
The model is designed to respond to coding related instructions and can be used to build coding assistants.
Generation
This is a simple example of how to use
Granite-8B-Code-Instruct-4K
model.
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
device = "cuda"# or "cpu"
model_path = "ibm-granite/granite-8b-code-instruct-4k"
tokenizer = AutoTokenizer.from_pretrained(model_path)
# drop device_map if running on CPU
model = AutoModelForCausalLM.from_pretrained(model_path, device_map=device)
model.eval()
# change input text as desired
chat = [
{ "role": "user", "content": "Write a code to find the maximum value in a list of numbers." },
]
chat = tokenizer.apply_chat_template(chat, tokenize=False, add_generation_prompt=True)
# tokenize the text
input_tokens = tokenizer(chat, return_tensors="pt")
# transfer tokenized inputs to the devicefor i in input_tokens:
input_tokens[i] = input_tokens[i].to(device)
# generate output tokens
output = model.generate(**input_tokens, max_new_tokens=100)
# decode output tokens into text
output = tokenizer.batch_decode(output)
# loop over the batch to print, in this example the batch size is 1for i in output:
print(i)
Runs of duyntnet granite-8b-code-instruct-imatrix-GGUF on huggingface.co
4.0K
Total runs
38
24-hour runs
-44
3-day runs
209
7-day runs
660
30-day runs
More Information About granite-8b-code-instruct-imatrix-GGUF huggingface.co Model
More granite-8b-code-instruct-imatrix-GGUF license Visit here:
granite-8b-code-instruct-imatrix-GGUF huggingface.co is an AI model on huggingface.co that provides granite-8b-code-instruct-imatrix-GGUF's model effect (), which can be used instantly with this duyntnet granite-8b-code-instruct-imatrix-GGUF model. huggingface.co supports a free trial of the granite-8b-code-instruct-imatrix-GGUF model, and also provides paid use of the granite-8b-code-instruct-imatrix-GGUF. Support call granite-8b-code-instruct-imatrix-GGUF model through api, including Node.js, Python, http.
granite-8b-code-instruct-imatrix-GGUF huggingface.co is an online trial and call api platform, which integrates granite-8b-code-instruct-imatrix-GGUF's modeling effects, including api services, and provides a free online trial of granite-8b-code-instruct-imatrix-GGUF, you can try granite-8b-code-instruct-imatrix-GGUF online for free by clicking the link below.
duyntnet granite-8b-code-instruct-imatrix-GGUF online free url in huggingface.co:
granite-8b-code-instruct-imatrix-GGUF is an open source model from GitHub that offers a free installation service, and any user can find granite-8b-code-instruct-imatrix-GGUF on GitHub to install. At the same time, huggingface.co provides the effect of granite-8b-code-instruct-imatrix-GGUF install, users can directly use granite-8b-code-instruct-imatrix-GGUF installed effect in huggingface.co for debugging and trial. It also supports api for free installation.
granite-8b-code-instruct-imatrix-GGUF install url in huggingface.co: