Introduction

Hammer 2.1 is a series of lightweight Large Action Models with strong function-calling capabilities. These models are based on the Qwen 2.5 coder series and utilize advanced techniques like function masking. Hammer 2.1 enhances the basic functionality of Hammer 2.0 by supporting multi-step and multi-turn function calling, improving the handling of irrelevant information, and maintaining high performance on benchmarks.

Architecture

The Hammer 2.1 models are fine-tuned from the Qwen 2.5 coder series. They improve upon Hammer 2.0 by:

  • Multi-Step Function Calling: Handling complex tasks through multiple internal function calls.
  • Multi-Turn Function Calling: Enabling continuous, context-aware interactions over multiple exchanges.
  • Enhanced Irrelevant Information Inspection: Improving responses when functions are irrelevant to user queries.

Training

Hammer 2.1 models have been evaluated on the Berkeley Function-Calling Leaderboard (BFCL-v3) and other academic benchmarks, consistently achieving superior performance compared to other models at similar scales.

Guide: Running Locally

Requirements

Ensure transformers>=4.47.0 is installed. The code is available in the latest Hugging Face Transformers.

Using vLLM

  1. Clone Repository:

    git clone https://github.com/MadeAgents/Hammer.git
    cd Hammer
    
  2. Serve Model with vLLM:

    vllm serve MadeAgents/Hammer2.1-7b --host 0.0.0.0 --port 8000 --tensor-parallel-size 1
    
  3. Interact with Model: Use the Hammer client or vLLM’s built-in tool calling.

Using Hugging Face Transformers

  1. Install Packages:

    import torch
    from transformers import AutoModelForCausalLM, AutoTokenizer
    
  2. Load Model:

    tokenizer = AutoTokenizer.from_pretrained("MadeAgents/Hammer2.1-7b")
    model = AutoModelForCausalLM.from_pretrained("MadeAgents/Hammer2.1-7b", torch_dtype=torch.bfloat16, device_map="auto")
    
  3. Run Example: Follow the example code provided to interact with the model.

Suggestion

For optimal performance, consider using cloud GPUs from providers like AWS, Azure, or Google Cloud.

License

The Hammer 2.1 models are licensed under the Creative Commons Attribution-NonCommercial 4.0 International (CC BY-NC 4.0).

More Related APIs