日本熟妇hd丰满老熟妇,中文字幕一区二区三区在线不卡 ,亚洲成片在线观看,免费女同在线一区二区

快速開始

Llama模型

Llama 3.1 系列是Meta推出的最新一代開源大語言模型,其 405B 版本是首個媲美頂級商業模型的開源大語言模型。

當前在DashScope部署的服務來自于ModelScope社區模型:

Llama3系列是來自Meta開發并公開發布的最新大型語言模型(LLMs)。該系列模型提供了多種參數大小(8B、70B等)的版本。相較于Llama2系列模型,Llama3系列在模型結構上沒有重大變化,但是訓練數據量進行了極大擴充,從 Llama2系列的2T Tokens擴大到了Llama3的15T Tokens,其中代碼數據擴充了4倍。

當前在DashScope部署的服務來自于ModelScope社區模型:

Llama2系列是來自Meta開發并公開發布的大型語言模型(LLMs)。該系列模型提供了多種參數大小(7B、13B和70B等)的版本,并同時提供了預訓練和針對對話場景的微調版本。 Llama2系列使用了2T token進行訓練,相比于LLama多出40%,上下文長度從LLama的2048升級到4096,可以理解更長的文本, 在多個公開基準測試上超過了已有的開源模型。采用了高質量的數據進行微調和基于人工反饋的強化學習訓練,具有較高的可靠性和安全性。

當前在DashScope部署的服務來自于ModelScope社區模型:

快速調用

前提條件

  • 已開通靈積服務并獲得API-KEY:API-KEY的獲取與配置

  • 已安裝最新版SDK:安裝DashScope SDK

  • 前往靈積模型廣場申請體驗您需要使用的Llama系列模型,等待申請通過即可使用該模型。

    重要

    如果您需要使用Llama 3.1模型,請開通百煉服務并前往百煉-模型廣場查找Llama 3.1模型并申請體驗,等待申請通過即可使用該模型。

文本生成

以下示例展示了調用Llama模型對一個用戶指令進行響應的代碼。

說明

需要使用您的API-KEY替換示例中的 YOUR_DASHSCOPE_API_KEY,代碼才能正常運行。

設置API-KEY

export DASHSCOPE_API_KEY=YOUR_DASHSCOPE_API_KEY
# For prerequisites running the following sample, visit http://bestwisewords.com/document_detail/611472.html
from http import HTTPStatus
import dashscope


def call_with_messages():
    messages = [{'role': 'system', 'content': 'You are a helpful assistant.'},
                {'role': 'user', 'content': '介紹下故宮?'}]
    response = dashscope.Generation.call(
        model='llama3-8b-instruct',
        messages=messages,
        result_format='message',  # set the result to be "message" format.
    )
    if response.status_code == HTTPStatus.OK:
        print(response)
    else:
        print('Request id: %s, Status code: %s, error code: %s, error message: %s' % (
            response.request_id, response.status_code,
            response.code, response.message
        ))


if __name__ == '__main__':
    call_with_messages()
// Copyright (c) Alibaba, Inc. and its affiliates.

import java.util.ArrayList;
import java.util.List;
import com.alibaba.dashscope.aigc.generation.Generation;
import com.alibaba.dashscope.aigc.generation.GenerationParam;
import com.alibaba.dashscope.aigc.generation.GenerationResult;
import com.alibaba.dashscope.common.Message;
import com.alibaba.dashscope.common.Role;
import com.alibaba.dashscope.exception.ApiException;
import com.alibaba.dashscope.exception.InputRequiredException;
import com.alibaba.dashscope.exception.NoApiKeyException;
import com.alibaba.dashscope.utils.JsonUtils;

public class Main {
  public static void usage()
      throws NoApiKeyException, ApiException, InputRequiredException {
    List<Message> messages = new ArrayList<>();
    Message systemMsg = Message.builder().role(Role.SYSTEM.getValue()).content("You are a helpful assistant.").build();
    Message userMsg = Message.builder().role(Role.USER.getValue()).content("介紹下杭州").build();
    messages.add(systemMsg);
    messages.add(userMsg);

    GenerationParam param = GenerationParam.builder()
        .model("llama3-8b-instruct")
        .messages(messages)
        .build();
    Generation gen = new Generation();
    GenerationResult result = gen.call(param);
    System.out.println(JsonUtils.toJson(result));
  }

  public static void main(String[] args) {
    try {
      usage();
    } catch (ApiException | NoApiKeyException | InputRequiredException e) {
      System.out.println(e.getMessage());
    }
    System.exit(0);
  }
}

返回結果

返回結果示例

{
  "status_code": 200,
  "request_id": "1b96a7d7-ca10-910d-9a8c-6af889021fdd",
  "code": "",
  "message": "",
  "output": {
    "text": null,
    "finish_reason": null,
    "choices": [
      {
        "finish_reason": "stop",
        "message": {
          "role": "assistant",
          "content": "The Forbidden City!  It's an iconic and historic palace complex located in the heart of Beijing, China. Here's an introduction:\n\n**History**\n\nThe Forbidden City was built in 1406 during the Ming Dynasty (1368-1644) and served as the imperial palace of the Ming and Qing dynasties (1644-1912) for over 500 years. It was the seat of power for 24 emperors and the center of Chinese politics, culture, and society.\n\n**Architecture**\n\nThe Forbidden City is a massive complex, covering an area of about 7 million square feet (0.7 million square meters). It's surrounded by a 7.3-meter-high (24-foot-high) wall and has a total of 980 buildings and over 8,700 rooms. The palace is designed in a traditional Chinese architectural style, with a blend of Han, Tibetan, and Mongolian influences.\n\n**Layout**\n\nThe Forbidden City is divided into three main parts: the Outer Court, the Middle Court, and the Inner Court. The Outer Court is where the emperor would receive foreign ambassadors and hold important ceremonies. The Middle Court is where the emperor would hold court and conduct official business. The Inner Court is where the emperor and his family lived.\n\n**Highlights**\n\nSome of the most famous attractions within the Forbidden City include:\n\n1. The Gate of Supreme Harmony: The main entrance to the palace complex.\n2. The Hall of Supreme Harmony: The largest and most impressive hall in the palace, where the emperor would hold important ceremonies.\n3. The Hall of Preserving Harmony: A beautiful hall with intricate carvings and paintings.\n4. The Palace of Heavenly Purity: The residence of the emperor and his family.\n5. The Imperial Garden: A tranquil oasis within the palace complex.\n\n**Interesting Facts**\n\n1. The Forbidden City is often referred to as the \"Palace Museum\" because it's a museum today.\n2. The complex has over 1 million precious artifacts, including ceramics, paintings, and jade carvings.\n3. The Forbidden City is a UNESCO World Heritage Site since 1987.\n4. The palace complex has undergone several restorations and renovations over the centuries, including a major restoration project in the 1980s.\n\n**Visiting the Forbidden City**\n\nThe Forbidden City is open to the public and attracts millions of visitors each year. Visitors can explore the complex on their own or take a guided tour. The best time to visit is during spring and autumn, when the weather is mild and comfortable.\n\nI hope this introduction has sparked your interest in the Forbidden City! "
        }
      }
    ]
  },
  "usage": {
    "input_tokens": 26,
    "output_tokens": 533,
    "total_tokens": 559
  }
}