Instructions to use ifable/gemma-2-Ifable-9B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ifable/gemma-2-Ifable-9B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ifable/gemma-2-Ifable-9B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("ifable/gemma-2-Ifable-9B") model = AutoModelForCausalLM.from_pretrained("ifable/gemma-2-Ifable-9B", device_map="auto") 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 Settings
- vLLM
How to use ifable/gemma-2-Ifable-9B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ifable/gemma-2-Ifable-9B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ifable/gemma-2-Ifable-9B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/ifable/gemma-2-Ifable-9B
- SGLang
How to use ifable/gemma-2-Ifable-9B 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 "ifable/gemma-2-Ifable-9B" \ --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": "ifable/gemma-2-Ifable-9B", "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 "ifable/gemma-2-Ifable-9B" \ --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": "ifable/gemma-2-Ifable-9B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use ifable/gemma-2-Ifable-9B with Docker Model Runner:
docker model run hf.co/ifable/gemma-2-Ifable-9B
Download all_results.json from ifable/gemma-2-Ifable-9B: direct link, hf CLI and curl.
- Browser
- Download file 1.34 kB
-
https://huggingface.co/ifable/gemma-2-Ifable-9B/resolve/main/all_results.json
- Command line
-
hf download hf://ifable/gemma-2-Ifable-9B/all_results.json
-
curl -L -o all_results.json https://huggingface.co/ifable/gemma-2-Ifable-9B/resolve/main/all_results.json
1.34 kB
| { | |
| "before_init_mem_cpu": 3802071040, | |
| "before_init_mem_gpu": 22016, | |
| "epoch": 0.9807355516637478, | |
| "eval_logits/chosen": -12.004097938537598, | |
| "eval_logits/rejected": -17.047502517700195, | |
| "eval_logps/chosen": -2.168222427368164, | |
| "eval_logps/rejected": -4.787535667419434, | |
| "eval_loss": 1.0162526369094849, | |
| "eval_mem_cpu_alloc_delta": 466944, | |
| "eval_mem_cpu_peaked_delta": 0, | |
| "eval_mem_gpu_alloc_delta": 0, | |
| "eval_mem_gpu_peaked_delta": 25220711424, | |
| "eval_rewards/accuracies": 0.9166666865348816, | |
| "eval_rewards/chosen": -21.682226181030273, | |
| "eval_rewards/margins": 26.193130493164062, | |
| "eval_rewards/rejected": -47.875362396240234, | |
| "eval_runtime": 9.9413, | |
| "eval_samples_per_second": 9.456, | |
| "eval_sft_loss": 0.01844729855656624, | |
| "eval_steps_per_second": 1.207, | |
| "init_mem_cpu_alloc_delta": 364544, | |
| "init_mem_cpu_peaked_delta": 0, | |
| "init_mem_gpu_alloc_delta": 0, | |
| "init_mem_gpu_peaked_delta": 0, | |
| "total_flos": 39867492466688.0, | |
| "train_loss": 3.085822834287371, | |
| "train_mem_cpu_alloc_delta": 5213659136, | |
| "train_mem_cpu_peaked_delta": 22737326080, | |
| "train_mem_gpu_alloc_delta": 16267848704, | |
| "train_mem_gpu_peaked_delta": 36029468160, | |
| "train_runtime": 1628.7465, | |
| "train_samples_per_second": 2.805, | |
| "train_steps_per_second": 0.021 | |
| } |