跳到主要內容區塊
  • 聯絡人:董諺承
  • 資料來源:國立中央大學

Llama 2 應用於教學端的研究議題 應用場景: 程式設計課程

歡迎來到應用場景: 程式設計課程示例, 我們將向您介紹操作界面,並提供一些簡單的操作示例,以協助您更好地理解如何應用Hugging Face於程式設計課程中。

下圖是Llama2 70B Chatbot的操作介面,包含: Prompt輸入區域、Submit按鈕以及結果呈現區塊。

操作步驟:
1. 於 "Prompt輸入區域" 輸入需求
2. 按下Submit按鈕

/001/Upload/592/relpic/-1/592/687eebe3-fb9a-466e-be71-0d3af52c14ae.png

簡單了解操作介面之後,接下來我們會介紹使用此模型的一些範例。

在此範例中,我們將題目需求(Prompt)輸入到對話框中,並點擊Submit,Llama模型就會依照指定需求生成回應。

Prompt: 

Design a Python programming question based on the content of lists, including list creation, list indexing and slicing, list methods (sorting, reverse, etc.) and nested lists. 

Result:

Sure, here's a sample question:

Question: You have a list of integers named 'numbers' containing numbers from 1 to 20. Write a Python code to create two new lists - 'even_numbers' containing all even numbers from 'numbers' and 'odd_numbers' containing all odd numbers from 'numbers'. Sort both lists in ascending order using the built-in sort() method. Finally, use list slicing to extract the first five elements of each sorted list and store them in separate variables.

Example input: numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]

Example output: even_first_five = [2, 4, 6, 8, 10] odd_first_five = [1, 3, 5, 7, 9]