Text Generation
Transformers
PyTorch
Safetensors
English
gpt2
code
autocomplete
text-generation-inference
Run this model with HF Jobs
Run shibing624/code-autocomplete-gpt2-base on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs and TRL to fine-tune https://huggingface.co/shibing624/code-autocomplete-gpt2-base. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/shibing624/code-autocomplete-gpt2-base on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/shibing624/code-autocomplete-gpt2-base. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Quantize for lower memory use
Use HF Jobs to create a 4-bit version of https://huggingface.co/shibing624/code-autocomplete-gpt2-base. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
Instructions to use shibing624/code-autocomplete-gpt2-base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use shibing624/code-autocomplete-gpt2-base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="shibing624/code-autocomplete-gpt2-base")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("shibing624/code-autocomplete-gpt2-base") model = AutoModelForCausalLM.from_pretrained("shibing624/code-autocomplete-gpt2-base", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use shibing624/code-autocomplete-gpt2-base with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "shibing624/code-autocomplete-gpt2-base" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "shibing624/code-autocomplete-gpt2-base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/shibing624/code-autocomplete-gpt2-base
- SGLang
How to use shibing624/code-autocomplete-gpt2-base 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 "shibing624/code-autocomplete-gpt2-base" \ --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": "shibing624/code-autocomplete-gpt2-base", "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 "shibing624/code-autocomplete-gpt2-base" \ --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": "shibing624/code-autocomplete-gpt2-base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use shibing624/code-autocomplete-gpt2-base with Docker Model Runner:
docker model run hf.co/shibing624/code-autocomplete-gpt2-base
Commit ·
9a23788
1
Parent(s): 07a5a56
Update README.md
Browse files12 unmodified lines13141516171819202122232 unmodified lines2627282930313278 unmodified lines1111121131141151161174 unmodified lines1221231241251261271281291 unmodified line13113213313413513613712 unmodified lines# GPT2 for Code AutoComplete Modelcode-autocomplete, a code completion plugin for Python.**code-autocomplete**实现了Python代码行粒度和块粒度自动补全功能。## Usage本项目开源在中文文本纠错项目:[code-autocomplete](https://github.com/shibing624/code-autocomplete),可支持GPT2模型,通过如下命令调用:```pythonfrom autocomplete.gpt2 import Infer2 unmodified linesprint(i)```当然,你也可使用官方的huggingface/transformers调用:*Please use 'GPT2' related functions to load this model!*78 unmodified lines```模型文件组成:```code-autocomplete-gpt2-base├── config.json4 unmodified lines└── vocab.json```### 训练数据集#### pytorch_awesome的所有项目代码download [code-autocomplete](https://github.com/shibing624/code-autocomplete),```shell1 unmodified linepython create_dataset.py```如果需要训练code-autocomplete,请参考[https://github.com/shibing624/code-autocomplete/blob/main/autocomplete/gpt2.py](https://github.com/shibing624/code-autocomplete/blob/main/autocomplete/gpt2.py)### About GPT212 unmodified lines13141516171819202122232 unmodified lines2627282930313278 unmodified lines1111121131141151161174 unmodified lines1221231241251261271281291 unmodified line13113213313413513613712 unmodified lines# GPT2 for Code AutoComplete Modelcode-autocomplete, a code completion plugin for Python.**code-autocomplete** can Automatic completion of code line granularity and block granularity.## UsageOpen source repo:[code-autocomplete](https://github.com/shibing624/code-autocomplete),support GPT2 model, usage:```pythonfrom autocomplete.gpt2 import Infer2 unmodified linesprint(i)```Also, use huggingface/transformers:*Please use 'GPT2' related functions to load this model!*78 unmodified lines```Model files:```code-autocomplete-gpt2-base├── config.json4 unmodified lines└── vocab.json```### Train data#### pytorch_awesome projects source codedownload [code-autocomplete](https://github.com/shibing624/code-autocomplete),```shell1 unmodified linepython create_dataset.py```If you want train code-autocomplete GPT2 model,refer [https://github.com/shibing624/code-autocomplete/blob/main/autocomplete/gpt2.py](https://github.com/shibing624/code-autocomplete/blob/main/autocomplete/gpt2.py)### About GPT2
README.md+7-7