Instructions to use parkneurals/Gemma with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use parkneurals/Gemma with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="parkneurals/Gemma")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("parkneurals/Gemma") model = AutoModelForCausalLM.from_pretrained("parkneurals/Gemma") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use parkneurals/Gemma with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "parkneurals/Gemma" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "parkneurals/Gemma", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/parkneurals/Gemma
- SGLang
How to use parkneurals/Gemma 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 "parkneurals/Gemma" \ --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": "parkneurals/Gemma", "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 "parkneurals/Gemma" \ --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": "parkneurals/Gemma", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use parkneurals/Gemma with Docker Model Runner:
docker model run hf.co/parkneurals/Gemma
Upload folder using huggingface_hub
Browse files- README.md +49 -0
- char_map.json +1 -0
- config.json +31 -0
- generation_config.json +10 -0
- model.safetensors +3 -0
README.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language:
|
| 3 |
+
- en
|
| 4 |
+
license: mit
|
| 5 |
+
library_name: transformers
|
| 6 |
+
tags:
|
| 7 |
+
- gemma
|
| 8 |
+
- text-generation
|
| 9 |
+
- transformer
|
| 10 |
+
datasets:
|
| 11 |
+
- karpathy/tiny_shakespeare
|
| 12 |
+
metrics:
|
| 13 |
+
- cross_entropy
|
| 14 |
+
---
|
| 15 |
+
|
| 16 |
+
scaled down version of the **Gemma** architecture trained on the **Tiny Shakespeare** dataset.
|
| 17 |
+
|
| 18 |
+
## Model
|
| 19 |
+
|
| 20 |
+
- **Architecture**: Gemma (Transformer Decoder)
|
| 21 |
+
- **Attention**: Multi Query Attention (MQA)
|
| 22 |
+
- **Hidden Size**: 768
|
| 23 |
+
- **Number of Layers**: 12
|
| 24 |
+
- **Number of Query Heads**: 2
|
| 25 |
+
- **Number of KV Heads**: 1
|
| 26 |
+
- **Sequence Length**: 128 (Block Size)
|
| 27 |
+
- **Vocabulary Size**: 65 (Character-level encoding)
|
| 28 |
+
- **Total Training Steps**: 3,500
|
| 29 |
+
|
| 30 |
+
## Architecture
|
| 31 |
+
|
| 32 |
+
1. **RMSNorm**
|
| 33 |
+
2. **GeGLU**
|
| 34 |
+
3. **RoPE**
|
| 35 |
+
4. **Embedding Scaling**
|
| 36 |
+
|
| 37 |
+
## Usage
|
| 38 |
+
|
| 39 |
+
You can load this model directly using the Hugging Face `transformers` library:
|
| 40 |
+
|
| 41 |
+
```python
|
| 42 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 43 |
+
|
| 44 |
+
model = AutoModelForCausalLM.from_pretrained("parkneurals/Gemma")
|
| 45 |
+
|
| 46 |
+
# Note: This model uses a custom character-level tokenizer.
|
| 47 |
+
# You can use the provided char_map.json for encoding/decoding.
|
| 48 |
+
# This model also has slow inference (as I made it only for learning purposes; please bear if anyone using)
|
| 49 |
+
```
|
char_map.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"\n": 0, " ": 1, "!": 2, "$": 3, "&": 4, "'": 5, ",": 6, "-": 7, ".": 8, "3": 9, ":": 10, ";": 11, "?": 12, "A": 13, "B": 14, "C": 15, "D": 16, "E": 17, "F": 18, "G": 19, "H": 20, "I": 21, "J": 22, "K": 23, "L": 24, "M": 25, "N": 26, "O": 27, "P": 28, "Q": 29, "R": 30, "S": 31, "T": 32, "U": 33, "V": 34, "W": 35, "X": 36, "Y": 37, "Z": 38, "a": 39, "b": 40, "c": 41, "d": 42, "e": 43, "f": 44, "g": 45, "h": 46, "i": 47, "j": 48, "k": 49, "l": 50, "m": 51, "n": 52, "o": 53, "p": 54, "q": 55, "r": 56, "s": 57, "t": 58, "u": 59, "v": 60, "w": 61, "x": 62, "y": 63, "z": 64}
|
config.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"GemmaForCausalLM"
|
| 4 |
+
],
|
| 5 |
+
"attention_bias": false,
|
| 6 |
+
"attention_dropout": 0.0,
|
| 7 |
+
"bos_token_id": 2,
|
| 8 |
+
"dtype": "float32",
|
| 9 |
+
"eos_token_id": 1,
|
| 10 |
+
"head_dim": 768,
|
| 11 |
+
"hidden_act": "gelu_pytorch_tanh",
|
| 12 |
+
"hidden_size": 768,
|
| 13 |
+
"initializer_range": 0.02,
|
| 14 |
+
"intermediate_size": 3072,
|
| 15 |
+
"max_position_embeddings": 8192,
|
| 16 |
+
"model_type": "gemma",
|
| 17 |
+
"num_attention_heads": 2,
|
| 18 |
+
"num_hidden_layers": 12,
|
| 19 |
+
"num_key_value_heads": 1,
|
| 20 |
+
"pad_token_id": 0,
|
| 21 |
+
"rms_norm_eps": 1e-06,
|
| 22 |
+
"rope_parameters": {
|
| 23 |
+
"rope_theta": 10000.0,
|
| 24 |
+
"rope_type": "default"
|
| 25 |
+
},
|
| 26 |
+
"tie_word_embeddings": true,
|
| 27 |
+
"transformers_version": "5.4.0",
|
| 28 |
+
"use_bidirectional_attention": null,
|
| 29 |
+
"use_cache": true,
|
| 30 |
+
"vocab_size": 65
|
| 31 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_from_model_config": true,
|
| 3 |
+
"bos_token_id": 2,
|
| 4 |
+
"eos_token_id": 1,
|
| 5 |
+
"output_attentions": false,
|
| 6 |
+
"output_hidden_states": false,
|
| 7 |
+
"pad_token_id": 0,
|
| 8 |
+
"transformers_version": "5.4.0",
|
| 9 |
+
"use_cache": true
|
| 10 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:fae8880de3aed81718d81f53b79293aed3dbcfef366ec7e131d717808d68d647
|
| 3 |
+
size 509896616
|