Text Generation
Transformers
Safetensors
English
llama
text-generation-inference
unsloth
trl
conversational
Instructions to use hiieu/Meta-Llama-3-8B-Instruct-function-calling-json-mode with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use hiieu/Meta-Llama-3-8B-Instruct-function-calling-json-mode with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="hiieu/Meta-Llama-3-8B-Instruct-function-calling-json-mode") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("hiieu/Meta-Llama-3-8B-Instruct-function-calling-json-mode") model = AutoModelForCausalLM.from_pretrained("hiieu/Meta-Llama-3-8B-Instruct-function-calling-json-mode") 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]:])) - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use hiieu/Meta-Llama-3-8B-Instruct-function-calling-json-mode with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "hiieu/Meta-Llama-3-8B-Instruct-function-calling-json-mode" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "hiieu/Meta-Llama-3-8B-Instruct-function-calling-json-mode", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/hiieu/Meta-Llama-3-8B-Instruct-function-calling-json-mode
- SGLang
How to use hiieu/Meta-Llama-3-8B-Instruct-function-calling-json-mode 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 "hiieu/Meta-Llama-3-8B-Instruct-function-calling-json-mode" \ --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": "hiieu/Meta-Llama-3-8B-Instruct-function-calling-json-mode", "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 "hiieu/Meta-Llama-3-8B-Instruct-function-calling-json-mode" \ --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": "hiieu/Meta-Llama-3-8B-Instruct-function-calling-json-mode", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Studio
How to use hiieu/Meta-Llama-3-8B-Instruct-function-calling-json-mode 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 hiieu/Meta-Llama-3-8B-Instruct-function-calling-json-mode 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 hiieu/Meta-Llama-3-8B-Instruct-function-calling-json-mode to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for hiieu/Meta-Llama-3-8B-Instruct-function-calling-json-mode to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="hiieu/Meta-Llama-3-8B-Instruct-function-calling-json-mode", max_seq_length=2048, ) - Docker Model Runner
How to use hiieu/Meta-Llama-3-8B-Instruct-function-calling-json-mode with Docker Model Runner:
docker model run hf.co/hiieu/Meta-Llama-3-8B-Instruct-function-calling-json-mode
Dataset used to fine-tune?
#2
by TeddyB - opened
Hi,
Could you please comment on the dataset that you used to train the model?
- Was it an open-source dataset, or a fully custom dataset?
- How many rows/data points did you need to train on to see good function-calling results?
- Have any tips on making a function calling dataset?
- The dataset I used is a fully custom dataset, however I did refine it from this dataset https://huggingface.co/datasets/hiyouga/glaive-function-calling-v2-sharegpt
- Usually it's the more the better, but I'm always start at 1k rows (depends on model, someone said 7x samples were enough to teach llama3 the pattern) to see the loss, performance, ... and decide if I want to adjust the hyperparameter
- Have a look a this to cross check every condition at making the dataset https://github.com/MeetKai/functionary?tab=readme-ov-file#the-differences-between-related-projects
Hope it helps :D
hiieu changed discussion status to closed