Text Generation
Transformers
Safetensors
PyTorch
English
gpt2
code-completion
huggingface
codexglue
nlp
machine-learning
Instructions to use Sai-Nandu/Code-Completion-using-GPT-2-CodeXGLUE with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Sai-Nandu/Code-Completion-using-GPT-2-CodeXGLUE with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Sai-Nandu/Code-Completion-using-GPT-2-CodeXGLUE")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Sai-Nandu/Code-Completion-using-GPT-2-CodeXGLUE", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Sai-Nandu/Code-Completion-using-GPT-2-CodeXGLUE with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Sai-Nandu/Code-Completion-using-GPT-2-CodeXGLUE" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Sai-Nandu/Code-Completion-using-GPT-2-CodeXGLUE", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Sai-Nandu/Code-Completion-using-GPT-2-CodeXGLUE
- SGLang
How to use Sai-Nandu/Code-Completion-using-GPT-2-CodeXGLUE 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 "Sai-Nandu/Code-Completion-using-GPT-2-CodeXGLUE" \ --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": "Sai-Nandu/Code-Completion-using-GPT-2-CodeXGLUE", "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 "Sai-Nandu/Code-Completion-using-GPT-2-CodeXGLUE" \ --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": "Sai-Nandu/Code-Completion-using-GPT-2-CodeXGLUE", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Sai-Nandu/Code-Completion-using-GPT-2-CodeXGLUE with Docker Model Runner:
docker model run hf.co/Sai-Nandu/Code-Completion-using-GPT-2-CodeXGLUE
| { | |
| "best_global_step": 800, | |
| "best_metric": 1.1868561506271362, | |
| "best_model_checkpoint": "gpt2-code-completion/checkpoint-800", | |
| "epoch": 3.0, | |
| "eval_steps": 100, | |
| "global_step": 846, | |
| "is_hyper_param_search": false, | |
| "is_local_process_zero": true, | |
| "is_world_process_zero": true, | |
| "log_history": [ | |
| { | |
| "epoch": 0.35555555555555557, | |
| "grad_norm": 0.7887430787086487, | |
| "learning_rate": 0.00017659574468085107, | |
| "loss": 1.5612648010253907, | |
| "step": 100 | |
| }, | |
| { | |
| "epoch": 0.35555555555555557, | |
| "eval_loss": 1.3591681718826294, | |
| "eval_runtime": 50.1494, | |
| "eval_samples_per_second": 19.94, | |
| "eval_steps_per_second": 9.97, | |
| "step": 100 | |
| }, | |
| { | |
| "epoch": 0.7111111111111111, | |
| "grad_norm": 0.5720292925834656, | |
| "learning_rate": 0.0001529550827423168, | |
| "loss": 1.396163330078125, | |
| "step": 200 | |
| }, | |
| { | |
| "epoch": 0.7111111111111111, | |
| "eval_loss": 1.2876965999603271, | |
| "eval_runtime": 49.6955, | |
| "eval_samples_per_second": 20.123, | |
| "eval_steps_per_second": 10.061, | |
| "step": 200 | |
| }, | |
| { | |
| "epoch": 1.064, | |
| "grad_norm": 0.5929608345031738, | |
| "learning_rate": 0.0001293144208037825, | |
| "loss": 1.331701202392578, | |
| "step": 300 | |
| }, | |
| { | |
| "epoch": 1.064, | |
| "eval_loss": 1.25370454788208, | |
| "eval_runtime": 49.8889, | |
| "eval_samples_per_second": 20.045, | |
| "eval_steps_per_second": 10.022, | |
| "step": 300 | |
| }, | |
| { | |
| "epoch": 1.4195555555555557, | |
| "grad_norm": 0.5653977990150452, | |
| "learning_rate": 0.00010567375886524824, | |
| "loss": 1.2437220001220703, | |
| "step": 400 | |
| }, | |
| { | |
| "epoch": 1.4195555555555557, | |
| "eval_loss": 1.2307533025741577, | |
| "eval_runtime": 49.6515, | |
| "eval_samples_per_second": 20.14, | |
| "eval_steps_per_second": 10.07, | |
| "step": 400 | |
| }, | |
| { | |
| "epoch": 1.775111111111111, | |
| "grad_norm": 0.5379767417907715, | |
| "learning_rate": 8.203309692671395e-05, | |
| "loss": 1.225320053100586, | |
| "step": 500 | |
| }, | |
| { | |
| "epoch": 1.775111111111111, | |
| "eval_loss": 1.2142291069030762, | |
| "eval_runtime": 49.7334, | |
| "eval_samples_per_second": 20.107, | |
| "eval_steps_per_second": 10.054, | |
| "step": 500 | |
| }, | |
| { | |
| "epoch": 2.128, | |
| "grad_norm": 0.5744788646697998, | |
| "learning_rate": 5.8392434988179665e-05, | |
| "loss": 1.2014379119873047, | |
| "step": 600 | |
| }, | |
| { | |
| "epoch": 2.128, | |
| "eval_loss": 1.1999704837799072, | |
| "eval_runtime": 49.9552, | |
| "eval_samples_per_second": 20.018, | |
| "eval_steps_per_second": 10.009, | |
| "step": 600 | |
| }, | |
| { | |
| "epoch": 2.4835555555555557, | |
| "grad_norm": 0.5410752892494202, | |
| "learning_rate": 3.4751773049645395e-05, | |
| "loss": 1.1546851348876954, | |
| "step": 700 | |
| }, | |
| { | |
| "epoch": 2.4835555555555557, | |
| "eval_loss": 1.1921426057815552, | |
| "eval_runtime": 49.6565, | |
| "eval_samples_per_second": 20.138, | |
| "eval_steps_per_second": 10.069, | |
| "step": 700 | |
| }, | |
| { | |
| "epoch": 2.8391111111111114, | |
| "grad_norm": 0.47747260332107544, | |
| "learning_rate": 1.1111111111111112e-05, | |
| "loss": 1.1642756652832031, | |
| "step": 800 | |
| }, | |
| { | |
| "epoch": 2.8391111111111114, | |
| "eval_loss": 1.1868561506271362, | |
| "eval_runtime": 49.8613, | |
| "eval_samples_per_second": 20.056, | |
| "eval_steps_per_second": 10.028, | |
| "step": 800 | |
| } | |
| ], | |
| "logging_steps": 100, | |
| "max_steps": 846, | |
| "num_input_tokens_seen": 0, | |
| "num_train_epochs": 3, | |
| "save_steps": 100, | |
| "stateful_callbacks": { | |
| "EarlyStoppingCallback": { | |
| "args": { | |
| "early_stopping_patience": 3, | |
| "early_stopping_threshold": 0.0 | |
| }, | |
| "attributes": { | |
| "early_stopping_patience_counter": 0 | |
| } | |
| }, | |
| "TrainerControl": { | |
| "args": { | |
| "should_epoch_stop": false, | |
| "should_evaluate": false, | |
| "should_log": false, | |
| "should_save": true, | |
| "should_training_stop": true | |
| }, | |
| "attributes": {} | |
| } | |
| }, | |
| "total_flos": 7054884864000000.0, | |
| "train_batch_size": 8, | |
| "trial_name": null, | |
| "trial_params": null | |
| } | |