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
Update README.md
Browse files
README.md
CHANGED
|
@@ -123,22 +123,6 @@ the model from defaulting to non-empty outputs).
|
|
| 123 |
- JSON validity: `0.1 · 𝟙[valid JSON dict]` (or `0.05` for non-dict valid JSON)
|
| 124 |
- task F1: `0.7 · F1(pred, gold)` — entity-set F1 for NER, triple-set F1 for RE
|
| 125 |
|
| 126 |
-
### Hyper-parameters
|
| 127 |
-
|
| 128 |
-
| | |
|
| 129 |
-
|---|---|
|
| 130 |
-
| Base model | Qwen3-4B-Instruct |
|
| 131 |
-
| Learning rate | 1e-6 |
|
| 132 |
-
| KL loss coeff. (low-var KL) | 0.01 |
|
| 133 |
-
| Train batch size (prompts) | 128 |
|
| 134 |
-
| PPO mini / micro batch | 64 / 4 per GPU |
|
| 135 |
-
| Rollouts per prompt (`n`) | 6 |
|
| 136 |
-
| Sampling | T=0.7, top-p=0.9 |
|
| 137 |
-
| Max prompt / response | 2048 / 2048 |
|
| 138 |
-
| Epochs | 1 (112 optimizer steps) |
|
| 139 |
-
| Rollout engine | vLLM (gpu_memory_utilization=0.6) |
|
| 140 |
-
| Distributed | FSDP via Ray, 8 × H200 GPUs |
|
| 141 |
-
| Wall-clock | ~1 h 18 min |
|
| 142 |
|
| 143 |
## Evaluation
|
| 144 |
|
|
|
|
| 123 |
- JSON validity: `0.1 · 𝟙[valid JSON dict]` (or `0.05` for non-dict valid JSON)
|
| 124 |
- task F1: `0.7 · F1(pred, gold)` — entity-set F1 for NER, triple-set F1 for RE
|
| 125 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 126 |
|
| 127 |
## Evaluation
|
| 128 |
|