Text Generation
Transformers
Safetensors
English
gemma
text-generation-inference
unsloth
trl
conversational
4-bit precision
bitsandbytes
Instructions to use thanhkt/codegemma-7B-ManimGen with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use thanhkt/codegemma-7B-ManimGen with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="thanhkt/codegemma-7B-ManimGen") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("thanhkt/codegemma-7B-ManimGen") model = AutoModelForCausalLM.from_pretrained("thanhkt/codegemma-7B-ManimGen") 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 thanhkt/codegemma-7B-ManimGen with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "thanhkt/codegemma-7B-ManimGen" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "thanhkt/codegemma-7B-ManimGen", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/thanhkt/codegemma-7B-ManimGen
- SGLang
How to use thanhkt/codegemma-7B-ManimGen 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 "thanhkt/codegemma-7B-ManimGen" \ --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": "thanhkt/codegemma-7B-ManimGen", "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 "thanhkt/codegemma-7B-ManimGen" \ --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": "thanhkt/codegemma-7B-ManimGen", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Studio new
How to use thanhkt/codegemma-7B-ManimGen with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for thanhkt/codegemma-7B-ManimGen to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for thanhkt/codegemma-7B-ManimGen to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for thanhkt/codegemma-7B-ManimGen to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="thanhkt/codegemma-7B-ManimGen", max_seq_length=2048, ) - Docker Model Runner
How to use thanhkt/codegemma-7B-ManimGen with Docker Model Runner:
docker model run hf.co/thanhkt/codegemma-7B-ManimGen
Create config.json
Browse files- config.json +44 -0
config.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_name_or_path": "unsloth/codegemma-7b-it",
|
| 3 |
+
"architectures": [
|
| 4 |
+
"GemmaForCausalLM"
|
| 5 |
+
],
|
| 6 |
+
"attention_bias": false,
|
| 7 |
+
"attention_dropout": 0.0,
|
| 8 |
+
"bos_token_id": 2,
|
| 9 |
+
"eos_token_id": 1,
|
| 10 |
+
"head_dim": 256,
|
| 11 |
+
"hidden_act": "gelu_pytorch_tanh",
|
| 12 |
+
"hidden_activation": "gelu_pytorch_tanh",
|
| 13 |
+
"hidden_size": 3072,
|
| 14 |
+
"initializer_range": 0.02,
|
| 15 |
+
"intermediate_size": 24576,
|
| 16 |
+
"max_position_embeddings": 8192,
|
| 17 |
+
"model_type": "gemma",
|
| 18 |
+
"num_attention_heads": 16,
|
| 19 |
+
"num_hidden_layers": 28,
|
| 20 |
+
"num_key_value_heads": 16,
|
| 21 |
+
"pad_token_id": 0,
|
| 22 |
+
"quantization_config": {
|
| 23 |
+
"_load_in_4bit": true,
|
| 24 |
+
"_load_in_8bit": false,
|
| 25 |
+
"bnb_4bit_compute_dtype": "bfloat16",
|
| 26 |
+
"bnb_4bit_quant_storage": "uint8",
|
| 27 |
+
"bnb_4bit_quant_type": "nf4",
|
| 28 |
+
"bnb_4bit_use_double_quant": true,
|
| 29 |
+
"llm_int8_enable_fp32_cpu_offload": false,
|
| 30 |
+
"llm_int8_has_fp16_weight": false,
|
| 31 |
+
"llm_int8_skip_modules": null,
|
| 32 |
+
"llm_int8_threshold": 6.0,
|
| 33 |
+
"load_in_4bit": true,
|
| 34 |
+
"load_in_8bit": false,
|
| 35 |
+
"quant_method": "bitsandbytes"
|
| 36 |
+
},
|
| 37 |
+
"rms_norm_eps": 1e-06,
|
| 38 |
+
"rope_theta": 10000.0,
|
| 39 |
+
"torch_dtype": "bfloat16",
|
| 40 |
+
"transformers_version": "4.44.2",
|
| 41 |
+
"unsloth_version": "2024.9",
|
| 42 |
+
"use_cache": true,
|
| 43 |
+
"vocab_size": 256000
|
| 44 |
+
}
|