Instructions to use Phind/Phind-CodeLlama-34B-Python-v1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Phind/Phind-CodeLlama-34B-Python-v1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Phind/Phind-CodeLlama-34B-Python-v1")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Phind/Phind-CodeLlama-34B-Python-v1") model = AutoModelForCausalLM.from_pretrained("Phind/Phind-CodeLlama-34B-Python-v1") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use Phind/Phind-CodeLlama-34B-Python-v1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Phind/Phind-CodeLlama-34B-Python-v1" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Phind/Phind-CodeLlama-34B-Python-v1", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Phind/Phind-CodeLlama-34B-Python-v1
- SGLang
How to use Phind/Phind-CodeLlama-34B-Python-v1 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 "Phind/Phind-CodeLlama-34B-Python-v1" \ --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": "Phind/Phind-CodeLlama-34B-Python-v1", "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 "Phind/Phind-CodeLlama-34B-Python-v1" \ --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": "Phind/Phind-CodeLlama-34B-Python-v1", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Phind/Phind-CodeLlama-34B-Python-v1 with Docker Model Runner:
docker model run hf.co/Phind/Phind-CodeLlama-34B-Python-v1
This might be the best coding model (Better than wizardcoder_python_34b)
This is the first model to pass my "code snake in python" test. The only other model that passed this was gpt 3.5
And yes i tested wizardcoder_python_34b it failed the code snake in python test
The following prompt was used to create the code for snake in text generation web ui
Prompt:
I need you to write 1 piece of python code for a functioning game of snake. Make sure to fill every line of code completely, do not leave any place holders, as logic for the code must be thought of now and implemented in this generation.
Make sure the game have a window to play in, has proper working food for the snake to collect, has the ability for the snake to eat the food and grow from the eaten food, has the ability for the snake to die from running into itself or the border of the window, and has a restart button once the game is over to play the game over again.
Make sure the game has a simple visual graphical interface for the user to see when playing, you will have to code this yourself. Absolutely make sure everything mentioned in the code is written, do not leave a class that is mentioned somewhere but not written out properly elsewhere Please follow this format when writing the code:
FILENAME
CODE
Thanks for sharing the Template, have you tweaked parameters like temperature or top-p to run it?, if so, can you share those?
I ran it on oobagooba web ui with the default simple-1 preset
This is the first model to pass my "code snake in python" test. The only other model that passed this was gpt 3.5
And yes i tested wizardcoder_python_34b it failed the code snake in python test
The following prompt was used to create the code for snake in text generation web ui
Prompt:
I need you to write 1 piece of python code for a functioning game of snake. Make sure to fill every line of code completely, do not leave any place holders, as logic for the code must be thought of now and implemented in this generation.Make sure the game have a window to play in, has proper working food for the snake to collect, has the ability for the snake to eat the food and grow from the eaten food, has the ability for the snake to die from running into itself or the border of the window, and has a restart button once the game is over to play the game over again.
Make sure the game has a simple visual graphical interface for the user to see when playing, you will have to code this yourself. Absolutely make sure everything mentioned in the code is written, do not leave a class that is mentioned somewhere but not written out properly elsewhere Please follow this format when writing the code:
FILENAMECODE
Have you tested without giving it a lecture about how games work? No one would have time to write all of that in real-world scenarios. Also, you said only GPT-3.5 got this correct, GPT-4 doesnt? Claude 2?
Stay tuned -- instruction-tuned V2 models are coming tomorrow :)