Skip to main content
text generation

Qwen2-7B-Instruct

by Qwen

license: apache-2.0

236,050 downloads692 likes
Get API Key

API Usage

Endpoint

POST https://api.gpu.fm/v1/inference

Request

curl -X POST https://api.gpu.fm/v1/inference \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "Qwen/Qwen2-7B-Instruct",
    "inputs": "Explain the theory of relativity in simple terms",
    "parameters": {
      "max_new_tokens": 256
    }
  }'

Response

{
  "result": "Albert Einstein's theory of relativity...",
  "usage": {
    "inputTokens": 12,
    "outputTokens": 128
  },
  "pricing": {
    "total": "0.000018"
  }
}

Python SDK

import requests

response = requests.post(
    "https://api.gpu.fm/v1/inference",
    headers={"Authorization": "Bearer YOUR_API_KEY"},
    json={
        "model": "Qwen/Qwen2-7B-Instruct",
        "inputs": "Explain the theory of relativity in simple terms",
        "parameters": {"max_new_tokens": 256}
    }
)

result = response.json()
print(result["result"])

Model Documentation

Full documentation available on HuggingFace →

Pricing

Input$0.13/1M tokens
Output$0.39/1M tokens

Billed from your prepaid credits. No minimum commitment.

Details

Model ID
Qwen/Qwen2-7B-Instruct
Library
transformers
Pipeline
text generation
Updated
8/21/2024

Tags

transformerssafetensorsqwen2text-generationchatconversationalenarxiv:2309.00071base_model:Qwen/Qwen2-7Bbase_model:finetune:Qwen/Qwen2-7B