Text Generation
PEFT
Safetensors
Transformers
Indonesian
Javanese
Sundanese
lora
qlora
sft
trl
unsloth
conversational
tool-use
indonesian
javanese
sundanese
gig-economy
ride-hailing
fairleap
Instructions to use fairleap-ai/fairleap-v1-clm-sahabatai-8b-adapter with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use fairleap-ai/fairleap-v1-clm-sahabatai-8b-adapter with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("GoToCompany/llama3-8b-cpt-sahabatai-v1-instruct") model = PeftModel.from_pretrained(base_model, "fairleap-ai/fairleap-v1-clm-sahabatai-8b-adapter") - Transformers
How to use fairleap-ai/fairleap-v1-clm-sahabatai-8b-adapter with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="fairleap-ai/fairleap-v1-clm-sahabatai-8b-adapter") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("fairleap-ai/fairleap-v1-clm-sahabatai-8b-adapter", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use fairleap-ai/fairleap-v1-clm-sahabatai-8b-adapter with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "fairleap-ai/fairleap-v1-clm-sahabatai-8b-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": "fairleap-ai/fairleap-v1-clm-sahabatai-8b-adapter", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/fairleap-ai/fairleap-v1-clm-sahabatai-8b-adapter
- SGLang
How to use fairleap-ai/fairleap-v1-clm-sahabatai-8b-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 "fairleap-ai/fairleap-v1-clm-sahabatai-8b-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": "fairleap-ai/fairleap-v1-clm-sahabatai-8b-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 "fairleap-ai/fairleap-v1-clm-sahabatai-8b-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": "fairleap-ai/fairleap-v1-clm-sahabatai-8b-adapter", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Desktop
- Docker Model Runner
How to use fairleap-ai/fairleap-v1-clm-sahabatai-8b-adapter with Docker Model Runner:
docker model run hf.co/fairleap-ai/fairleap-v1-clm-sahabatai-8b-adapter
| {#- Tool-capable Llama-3 chat template for the Fairleap corpus. | |
| The stock Sahabat-AI template renders every message as | |
| `content | trim` and ignores both `tool_calls` and the `tools` argument. | |
| On this corpus that is silent data loss, not an error: an assistant | |
| tool-call turn carries `content: ""`, so it renders as an *empty* | |
| assistant reply and the call disappears. ~10% of the corpus is shaped | |
| that way. | |
| Two things this adds: | |
| 1. assistant `tool_calls` render as the one-line JSON the model is | |
| meant to emit, and `role: tool` results come back as a `user` turn | |
| wrapping `<tool_response>` so response-only masking still works | |
| (see the note on that branch); | |
| 2. the `tools` schema list is folded into the system turn, so | |
| "tool offered" and "tool not offered" are distinguishable in | |
| context. Without that the model cannot learn when *not* to call. | |
| -#} | |
| {{- bos_token }} | |
| {%- set has_system = messages and messages[0]['role'] == 'system' %} | |
| {%- set tool_header = 'Kamu punya akses ke fungsi berikut. Untuk memanggil fungsi, balas HANYA dengan satu baris JSON berbentuk {"name": <nama fungsi>, "parameters": <objek argumen>}, tanpa teks lain. Panggil fungsi hanya jika pertanyaan driver memang membutuhkannya.\n\nFungsi yang tersedia:' %} | |
| {%- if tools and not has_system %} | |
| {{- '<|start_header_id|>system<|end_header_id|>\n\n' + tool_header }} | |
| {%- for tool in tools %} | |
| {{- '\n' }}{{- tool['function'] | tojson }} | |
| {%- endfor %} | |
| {{- '<|eot_id|>' }} | |
| {%- endif %} | |
| {%- for message in messages %} | |
| {%- if message['role'] == 'system' %} | |
| {{- '<|start_header_id|>system<|end_header_id|>\n\n' + message['content'] | trim }} | |
| {%- if tools and loop.first %} | |
| {{- '\n\n' + tool_header }} | |
| {%- for tool in tools %} | |
| {{- '\n' }}{{- tool['function'] | tojson }} | |
| {%- endfor %} | |
| {%- endif %} | |
| {{- '<|eot_id|>' }} | |
| {%- elif message['role'] == 'assistant' and message.get('tool_calls') %} | |
| {{- '<|start_header_id|>assistant<|end_header_id|>\n\n' }} | |
| {%- for tool_call in message['tool_calls'] %} | |
| {#- Emit each piece separately: `tojson` returns Markup, and | |
| concatenating a plain string with it HTML-escapes the quotes. #} | |
| {{- '{"name": "' }}{{- tool_call['function']['name'] }}{{- '", "parameters": ' }} | |
| {{- tool_call['function']['arguments'] | tojson }}{{- '}' }} | |
| {%- endfor %} | |
| {{- '<|eot_id|>' }} | |
| {%- elif message['role'] == 'tool' %} | |
| {#- Deliberately a `user` turn wrapping `<tool_response>`, not Llama-3.1's | |
| `ipython` header. `train_on_responses_only` masks from the response | |
| delimiter to the next *instruction* delimiter, and an `ipython` | |
| header matches neither -- the tool result would land inside the loss | |
| and teach the model to invent forecasts. This is also byte-for-byte | |
| the shape Qwen's own template uses, so both Fairleap adapters take | |
| tool results in the same form. #} | |
| {{- '<|start_header_id|>user<|end_header_id|>\n\n<tool_response>\n' + message['content'] | trim + '\n</tool_response><|eot_id|>' }} | |
| {%- else %} | |
| {{- '<|start_header_id|>' + message['role'] + '<|end_header_id|>\n\n' + message['content'] | trim + '<|eot_id|>' }} | |
| {%- endif %} | |
| {%- endfor %} | |
| {%- if add_generation_prompt %} | |
| {{- '<|start_header_id|>assistant<|end_header_id|>\n\n' }} | |
| {%- endif %} | |