Text Generation
Transformers
Safetensors
English
qwen3
information-extraction
named-entity-recognition
relation-extraction
grpo
reinforcement-learning
scientific-text
biomedical
conversational
text-generation-inference
Instructions to use InternScience/Agents-K1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use InternScience/Agents-K1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="InternScience/Agents-K1") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForMultimodalLM tokenizer = AutoTokenizer.from_pretrained("InternScience/Agents-K1") model = AutoModelForMultimodalLM.from_pretrained("InternScience/Agents-K1") 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 InternScience/Agents-K1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "InternScience/Agents-K1" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "InternScience/Agents-K1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/InternScience/Agents-K1
- SGLang
How to use InternScience/Agents-K1 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 "InternScience/Agents-K1" \ --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": "InternScience/Agents-K1", "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 "InternScience/Agents-K1" \ --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": "InternScience/Agents-K1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use InternScience/Agents-K1 with Docker Model Runner:
docker model run hf.co/InternScience/Agents-K1
Upload README.md
Browse files
README.md
CHANGED
|
@@ -16,7 +16,7 @@ tags:
|
|
| 16 |
- biomedical
|
| 17 |
---
|
| 18 |
|
| 19 |
-
#
|
| 20 |
|
| 21 |
**Knowledge extraction model in Agents-K1** is a 4B-parameter language model fine-tuned from
|
| 22 |
[`Qwen/Qwen3-4B-Instruct-2507`](https://huggingface.co/Qwen/Qwen3-4B-Instruct-2507)
|
|
@@ -59,7 +59,7 @@ an `<answer>` block with a JSON object.
|
|
| 59 |
```python
|
| 60 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 61 |
|
| 62 |
-
model_id = "
|
| 63 |
tok = AutoTokenizer.from_pretrained(model_id)
|
| 64 |
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype="bfloat16", device_map="auto")
|
| 65 |
|
|
@@ -127,7 +127,7 @@ the model from defaulting to non-empty outputs).
|
|
| 127 |
## Evaluation
|
| 128 |
|
| 129 |
Reported numbers are micro-F1 on each benchmark's official test split, using
|
| 130 |
-
the same prompt template as training. Gains are **base →
|
| 131 |
|
| 132 |
| Dataset | Task | n | Base F1 | Agent-K1 F1 | Δ |
|
| 133 |
|---------------------------------|:----:|------:|--------:|--------------:|------:|
|
|
|
|
| 16 |
- biomedical
|
| 17 |
---
|
| 18 |
|
| 19 |
+
# Agents-K1
|
| 20 |
|
| 21 |
**Knowledge extraction model in Agents-K1** is a 4B-parameter language model fine-tuned from
|
| 22 |
[`Qwen/Qwen3-4B-Instruct-2507`](https://huggingface.co/Qwen/Qwen3-4B-Instruct-2507)
|
|
|
|
| 59 |
```python
|
| 60 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 61 |
|
| 62 |
+
model_id = "InternScience/Agents-K1"
|
| 63 |
tok = AutoTokenizer.from_pretrained(model_id)
|
| 64 |
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype="bfloat16", device_map="auto")
|
| 65 |
|
|
|
|
| 127 |
## Evaluation
|
| 128 |
|
| 129 |
Reported numbers are micro-F1 on each benchmark's official test split, using
|
| 130 |
+
the same prompt template as training. Gains are **base → Agents-K1 (GRPO)**.
|
| 131 |
|
| 132 |
| Dataset | Task | n | Base F1 | Agent-K1 F1 | Δ |
|
| 133 |
|---------------------------------|:----:|------:|--------:|--------------:|------:|
|