Instructions to use flax-community/gpt-neo-125M-code-search-py with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use flax-community/gpt-neo-125M-code-search-py with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="flax-community/gpt-neo-125M-code-search-py")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("flax-community/gpt-neo-125M-code-search-py") model = AutoModelForCausalLM.from_pretrained("flax-community/gpt-neo-125M-code-search-py") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use flax-community/gpt-neo-125M-code-search-py with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "flax-community/gpt-neo-125M-code-search-py" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "flax-community/gpt-neo-125M-code-search-py", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/flax-community/gpt-neo-125M-code-search-py
- SGLang
How to use flax-community/gpt-neo-125M-code-search-py 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 "flax-community/gpt-neo-125M-code-search-py" \ --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": "flax-community/gpt-neo-125M-code-search-py", "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 "flax-community/gpt-neo-125M-code-search-py" \ --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": "flax-community/gpt-neo-125M-code-search-py", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use flax-community/gpt-neo-125M-code-search-py with Docker Model Runner:
docker model run hf.co/flax-community/gpt-neo-125M-code-search-py
YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
GPT-Code-Clippy-125M-Code-Search-Py
Please refer to our new GitHub Wiki which documents our efforts in detail in creating the open source version of GitHub Copilot
Model Description
GPT-CC-125M-Code-Search is a GPT-Neo-125M model finetuned using causal language modeling on only the python language in the CodeSearchNet Challenge dataset. This model is specialized to autocomplete methods in the python language.
Training data
CodeSearchNet Challenge dataset.
Training procedure
The training script used to train this model can be found here.
./run_clm_flax.py \
--output_dir $HOME/gpt-neo-125M-code-search-py \
--model_name_or_path="EleutherAI/gpt-neo-125M" \
--dataset_name code_search_net \
--dataset_config_name="python" \
--do_train --do_eval \
--block_size="512" \
--per_device_train_batch_size="32" \
--per_device_eval_batch_size="64" \
--preprocessing_num_workers="8" \
--learning_rate="1.2e-4" \
--num_train_epochs 20 \
--warmup_steps 3000 \
--adam_beta1="0.9" \
--adam_beta2="0.95" \
--weight_decay="0.1" \
--overwrite_output_dir \
--logging_steps="25" \
--eval_steps="500" \
--push_to_hub="False" \
--report_to="all" \
--dtype="bfloat16" \
--skip_memory_metrics="True" \
--save_steps="500" \
--save_total_limit 10 \
--report_to="wandb" \
--run_name="gpt-neo-125M-code-search-py"
Intended Use and Limitations
The model is finetuned methods from the python language and is intended to autocomplete python methods given some prompt (method signature and docstring).
How to use
You can use this model directly with a pipeline for text generation. This example generates a different sequence each time it's run:
from transformers import AutoModelForCausalLM, AutoTokenizer, FlaxAutoModelForCausalLM
model = AutoModelForCausalLM.from_pretrained("flax-community/gpt-neo-125M-code-clippy-code-search-py")
tokenizer = AutoTokenizer.from_pretrained("flax-community/gpt-neo-125M-code-clippy-code-search-py")
prompt = """def greet(name):
'''A function to greet user. Given a user name it should say hello'''
"""
input_ids = tokenizer(prompt, return_tensors='pt').input_ids.to(device)
start = input_ids.size(1)
out = model.generate(input_ids, do_sample=True, max_length=50, num_beams=2,
early_stopping=True, eos_token_id=tokenizer.eos_token_id, )
print(tokenizer.decode(out[0][start:]))
Limitations and Biases
The model is intended to be used for research purposes and comes with no guarantees of quality of generated code.
GPT-CC is finetuned from GPT-Neo and might have inherited biases and limitations from it. See GPT-Neo model card for details.
Eval results
Coming soon...
- Downloads last month
- 5