Instructions to use sokada/codegen25-7b-multi-gguf-with-dummy-tokenizer with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use sokada/codegen25-7b-multi-gguf-with-dummy-tokenizer with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="sokada/codegen25-7b-multi-gguf-with-dummy-tokenizer")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("sokada/codegen25-7b-multi-gguf-with-dummy-tokenizer") model = AutoModelForCausalLM.from_pretrained("sokada/codegen25-7b-multi-gguf-with-dummy-tokenizer") - llama-cpp-python
How to use sokada/codegen25-7b-multi-gguf-with-dummy-tokenizer with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="sokada/codegen25-7b-multi-gguf-with-dummy-tokenizer", filename="ggml-model-Q4_K.gguf", )
output = llm( "Once upon a time,", max_tokens=512, echo=True ) print(output)
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use sokada/codegen25-7b-multi-gguf-with-dummy-tokenizer with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf sokada/codegen25-7b-multi-gguf-with-dummy-tokenizer:F16 # Run inference directly in the terminal: llama-cli -hf sokada/codegen25-7b-multi-gguf-with-dummy-tokenizer:F16
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf sokada/codegen25-7b-multi-gguf-with-dummy-tokenizer:F16 # Run inference directly in the terminal: llama-cli -hf sokada/codegen25-7b-multi-gguf-with-dummy-tokenizer:F16
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 sokada/codegen25-7b-multi-gguf-with-dummy-tokenizer:F16 # Run inference directly in the terminal: ./llama-cli -hf sokada/codegen25-7b-multi-gguf-with-dummy-tokenizer:F16
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 sokada/codegen25-7b-multi-gguf-with-dummy-tokenizer:F16 # Run inference directly in the terminal: ./build/bin/llama-cli -hf sokada/codegen25-7b-multi-gguf-with-dummy-tokenizer:F16
Use Docker
docker model run hf.co/sokada/codegen25-7b-multi-gguf-with-dummy-tokenizer:F16
- LM Studio
- Jan
- vLLM
How to use sokada/codegen25-7b-multi-gguf-with-dummy-tokenizer with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "sokada/codegen25-7b-multi-gguf-with-dummy-tokenizer" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "sokada/codegen25-7b-multi-gguf-with-dummy-tokenizer", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/sokada/codegen25-7b-multi-gguf-with-dummy-tokenizer:F16
- SGLang
How to use sokada/codegen25-7b-multi-gguf-with-dummy-tokenizer 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 "sokada/codegen25-7b-multi-gguf-with-dummy-tokenizer" \ --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": "sokada/codegen25-7b-multi-gguf-with-dummy-tokenizer", "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 "sokada/codegen25-7b-multi-gguf-with-dummy-tokenizer" \ --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": "sokada/codegen25-7b-multi-gguf-with-dummy-tokenizer", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Ollama
How to use sokada/codegen25-7b-multi-gguf-with-dummy-tokenizer with Ollama:
ollama run hf.co/sokada/codegen25-7b-multi-gguf-with-dummy-tokenizer:F16
- Unsloth Studio
How to use sokada/codegen25-7b-multi-gguf-with-dummy-tokenizer 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 sokada/codegen25-7b-multi-gguf-with-dummy-tokenizer 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 sokada/codegen25-7b-multi-gguf-with-dummy-tokenizer to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for sokada/codegen25-7b-multi-gguf-with-dummy-tokenizer to start chatting
- Docker Model Runner
How to use sokada/codegen25-7b-multi-gguf-with-dummy-tokenizer with Docker Model Runner:
docker model run hf.co/sokada/codegen25-7b-multi-gguf-with-dummy-tokenizer:F16
- Lemonade
How to use sokada/codegen25-7b-multi-gguf-with-dummy-tokenizer with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull sokada/codegen25-7b-multi-gguf-with-dummy-tokenizer:F16
Run and chat with the model
lemonade run user.codegen25-7b-multi-gguf-with-dummy-tokenizer-F16
List all available models
lemonade list
Install from WinGet (Windows)
winget install llama.cpp
# Start a local OpenAI-compatible server with a web UI:
llama-server -hf sokada/codegen25-7b-multi-gguf-with-dummy-tokenizer:F16# Run inference directly in the terminal:
llama-cli -hf sokada/codegen25-7b-multi-gguf-with-dummy-tokenizer:F16Use 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 sokada/codegen25-7b-multi-gguf-with-dummy-tokenizer:F16# Run inference directly in the terminal:
./llama-cli -hf sokada/codegen25-7b-multi-gguf-with-dummy-tokenizer:F16Build 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 sokada/codegen25-7b-multi-gguf-with-dummy-tokenizer:F16# Run inference directly in the terminal:
./build/bin/llama-cli -hf sokada/codegen25-7b-multi-gguf-with-dummy-tokenizer:F16Use Docker
docker model run hf.co/sokada/codegen25-7b-multi-gguf-with-dummy-tokenizer:F16This repo is a fork for flatline_lsp
See flatline_lsp.
This repository is a fork of Salesforce/codegen25-7b-multi. This repository contains gguf files but its tokenizer is dummy.
CodeGen2.5-7B-multi
Title: CodeGen2.5: Small, but mighty
Authors: Erik Nijkamp*, Hiroaki Hayashi*, Yingbo Zhou, Caiming Xiong
(* equal contribution)
Model description
CodeGen2.5 is a family of autoregressive language models for program synthesis.
Building upon CodeGen2, the model is trained on StarCoderData for 1.4T tokens, achieving competitive results compared to StarCoderBase-15.5B with less than half the size.
Like CodeGen2, this model is capable of infilling, and supports multiple programming languages.
We then further train on Python, then on instruction data. We release all the models as follows:
- CodeGen2.5-7B-multi (this repo): Trained on StarCoderData. Licensed under Apache-2.0.
- CodeGen2.5-7B-mono: Further trained on additional Python tokens. Licensed under Apache-2.0.
- CodeGen2.5-7B-instruct: Further trained from CodeGen2.5-7B-mono on instruction data. Research purposes only.
How to use
This model can be easily loaded using the AutoModelForCausalLM functionality.
Pre-requisite
Please install OpenAI tiktoken for the tokenizer.
pip install tiktoken==0.4.0
Causal sampling (code autocompletion)
For regular causal sampling, simply generate completions given the context:
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("Salesforce/codegen25-7b-multi", trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained("Salesforce/codegen25-7b-multi")
text = "def hello_world():"
input_ids = tokenizer(text, return_tensors="pt").input_ids
generated_ids = model.generate(input_ids, max_length=128)
print(tokenizer.decode(generated_ids[0], skip_special_tokens=True))
Infill sampling
For infill sampling, we follow the CodeGen2 format:
<mask_N>: N-th span to be masked. In practice, use<mask_1>to where you want to sample infill.<sep>: Separator token between the suffix and the infilled sample. See below.<eom>: "End-Of-Mask" token that model will output at the end of infilling. You may use this token to truncate the output.
For example, if we want to generate infill for the following cursor position of a function:
def hello_world():
|
return name
we construct an input to the model by
- Inserting
<mask_1>token in place of cursor position - Append
<sep>token to indicate the boundary - Insert another
<mask_1>to indicate which mask we want to infill.
The final snippet looks as follows:
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("Salesforce/codegen25-7b-multi", trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained("Salesforce/codegen25-7b-multi")
def format(prefix, suffix):
return prefix + "<mask_1>" + suffix + "<|endoftext|>" + "<sep>" + "<mask_1>"
prefix = "def hello_world():\n "
suffix = " return name"
text = format(prefix, suffix)
input_ids = tokenizer(text, return_tensors="pt").input_ids
generated_ids = model.generate(input_ids, max_length=128)
print(tokenizer.decode(generated_ids[0], skip_special_tokens=False)[len(text):])
You might want to truncate the model output with <eom>.
Evaluation results
We evaluate our models on HumanEval and HumanEval-Infill. Please refer to the blog for more details.
Intended use and limitations
As an autoregressive language model, CodeGen2.5 is capable of extracting features from given natural language and programming language texts, and calculating the likelihood of them. However, the model is intended for and best at program synthesis, that is, generating executable code given English prompts, where the prompts should be in the form of a comment string. The model can complete partially-generated code as well.
Attribution & Other Requirements
The pretraining dataset of the model was filtered for permissive licenses only. Nevertheless, the model can generate source code verbatim from the dataset. The code's license might require attribution and/or other specific requirements that must be respected. The data provider BigCode provides a search index that lets you search through the pretraining data to identify where generated code came from and apply the proper attribution to your code.
BibTeX entry and citation info
Please cite CodeGen2 paper:
@article{Nijkamp2023codegen2,
title={CodeGen2: Lessons for Training LLMs on Programming and Natural Languages},
author={Nijkamp, Erik and Hayashi, Hiroaki and Xiong, Caiming and Savarese, Silvio and Zhou, Yingbo},
journal={arXiv preprint},
year={2023}
}
- Downloads last month
- 601
16-bit
32-bit
Install from brew
# Start a local OpenAI-compatible server with a web UI: llama-server -hf sokada/codegen25-7b-multi-gguf-with-dummy-tokenizer:F16# Run inference directly in the terminal: llama-cli -hf sokada/codegen25-7b-multi-gguf-with-dummy-tokenizer:F16