Instructions to use mrSoul7766/gemma-2b-it-python-code-gen-adapter with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use mrSoul7766/gemma-2b-it-python-code-gen-adapter with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="mrSoul7766/gemma-2b-it-python-code-gen-adapter") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("mrSoul7766/gemma-2b-it-python-code-gen-adapter") model = AutoModelForCausalLM.from_pretrained("mrSoul7766/gemma-2b-it-python-code-gen-adapter") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use mrSoul7766/gemma-2b-it-python-code-gen-adapter with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "mrSoul7766/gemma-2b-it-python-code-gen-adapter" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mrSoul7766/gemma-2b-it-python-code-gen-adapter", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/mrSoul7766/gemma-2b-it-python-code-gen-adapter
- SGLang
How to use mrSoul7766/gemma-2b-it-python-code-gen-adapter 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 "mrSoul7766/gemma-2b-it-python-code-gen-adapter" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mrSoul7766/gemma-2b-it-python-code-gen-adapter", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "mrSoul7766/gemma-2b-it-python-code-gen-adapter" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mrSoul7766/gemma-2b-it-python-code-gen-adapter", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use mrSoul7766/gemma-2b-it-python-code-gen-adapter with Docker Model Runner:
docker model run hf.co/mrSoul7766/gemma-2b-it-python-code-gen-adapter
Update README.md
Browse files
README.md
CHANGED
|
@@ -30,7 +30,19 @@ This is the model card of a 🤗 transformers model that has been pushed on the
|
|
| 30 |
### Direct Use
|
| 31 |
|
| 32 |
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
|
| 33 |
-
Use this model to generate Python code.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
|
| 35 |
```python
|
| 36 |
# Load model directly
|
|
@@ -53,18 +65,6 @@ print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
|
| 53 |
```
|
| 54 |
|
| 55 |
|
| 56 |
-
### Out-of-Scope Use
|
| 57 |
-
|
| 58 |
-
<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
|
| 59 |
-
This model is trained on very basic Python code, so it might not be able to handle complex code.
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
## How to Get Started with the Model
|
| 63 |
-
|
| 64 |
-
Use the code below to get started with the model.
|
| 65 |
-
|
| 66 |
-
[More Information Needed]
|
| 67 |
-
|
| 68 |
## Training Details
|
| 69 |
|
| 70 |
|
|
@@ -108,7 +108,6 @@ Use the code below to get started with the model.
|
|
| 108 |
|
| 109 |
### Results
|
| 110 |
|
| 111 |
-
[More Information Needed]
|
| 112 |
```python
|
| 113 |
import json
|
| 114 |
import pandas as pd
|
|
|
|
| 30 |
### Direct Use
|
| 31 |
|
| 32 |
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
|
| 33 |
+
Use this model to generate Python code.
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
### Out-of-Scope Use
|
| 38 |
+
|
| 39 |
+
<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
|
| 40 |
+
This model is trained on very basic Python code, so it might not be able to handle complex code.
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
## How to Get Started with the Model
|
| 44 |
+
|
| 45 |
+
Use the code below to get started with the model.
|
| 46 |
|
| 47 |
```python
|
| 48 |
# Load model directly
|
|
|
|
| 65 |
```
|
| 66 |
|
| 67 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
## Training Details
|
| 69 |
|
| 70 |
|
|
|
|
| 108 |
|
| 109 |
### Results
|
| 110 |
|
|
|
|
| 111 |
```python
|
| 112 |
import json
|
| 113 |
import pandas as pd
|