ardavey commited on
Commit
0398dae
·
verified ·
1 Parent(s): c3d354b

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +0 -148
README.md CHANGED
@@ -1,148 +0,0 @@
1
- # Model: Llama-3.1-70B-Instruct
2
-
3
- Model ini adalah model instruksi yang telah difinetuned dan dievaluasi untuk menghasilkan catatan, flashcards, dan kuis berdasarkan konten yang diberikan. Model ini menggunakan Hugging Face API dengan fine-grained token untuk mengakses model.
4
-
5
- ## Cara Menggunakan Model
6
-
7
- ### Python
8
-
9
- Berikut adalah contoh kode Python untuk menggunakan model ini:
10
-
11
- ```python
12
- from openai import OpenAI
13
- from IPython.display import display, Markdown
14
-
15
- client = OpenAI(
16
- api_key="hf_xxxxxxxxxxxxxxx", # isi dengan token "FINE GRAINED" huggingface anda!
17
- base_url="https://huggingface.co/api/integrations/dgx/v1",
18
- )
19
-
20
- # System prompts - pastikan ini sudah didefinisikan
21
- notes_prompt = "..." // wajib isi dengan prompt notes yang sudah ditentukan (notes_prompt.txt)
22
- flashcards_prompt = "..." // wajib isi dengan prompt flashcards yang sudah ditentukan (flashcards_prompt.txt)
23
- quiz_prompt = "..." // wajib isi dengan prompt quiz yang sudah ditentukan (quiz_prompt.txt)
24
- content = "..." // isi dengan dokumen yang sudah di ekstrak (PDF, TXT, DOCX)
25
-
26
-
27
- # 1. Generate notes
28
- notes_response = client.chat.completions.create(
29
- model="meta-llama/Llama-3.1-70B-Instruct",
30
- messages=[
31
- {"role": "system", "content": notes_prompt},
32
- {"role": "user", "content": content},
33
- ],
34
- temperature=0.3,
35
- max_tokens=10_000
36
- )
37
-
38
- # Notes response
39
- notes_md = notes_response.choices[0].message.content
40
-
41
- # 2. Generate flashcards
42
- flashcards_response = client.chat.completions.create(
43
- model="meta-llama/Llama-3.1-70B-Instruct",
44
- messages=[
45
- {"role": "system", "content": flashcards_prompt},
46
- {"role": "user", "content": notes_md},
47
- ],
48
- temperature=0.3,
49
- max_tokens=1024
50
- )
51
-
52
- # flashcards response
53
- flashcards_md = flashcards_response.choices[0].message.content
54
-
55
- # 3. Generate quiz
56
- quiz_response = client.chat.completions.create(
57
- model="meta-llama/Llama-3.1-70B-Instruct",
58
- messages=[
59
- {"role": "system", "content": quiz_prompt},
60
- {"role": "user", "content": notes_md},
61
- ],
62
- temperature=0.3,
63
- max_tokens=5048
64
- )
65
-
66
- # Quiz response
67
- quiz_md = quiz_response.choices[0].message.content
68
-
69
-
70
-
71
- print(notes_md)
72
- print(flashcards_md)
73
- print(quiz_md)
74
- ```
75
-
76
- ### Javascript
77
- ```javascript
78
- import { HfInference } from "@huggingface/inference";
79
-
80
- const client = new HfInference("hf_xxxxxxxxxxxxxxx"); // isi dengan token "FINE GRAINED" huggingface anda!
81
-
82
- // System prompts - pastikan ini sudah didefinisikan
83
- const notes_prompt = "..." // wajib isi dengan prompt notes yang sudah ditentukan (notes_prompt.txt)
84
- const flashcards_prompt = "..." // wajib isi dengan prompt flashcards yang sudah ditentukan (flashcards_prompt.txt)
85
- const quiz_prompt = "..." // wajib isi dengan prompt quiz yang sudah ditentukan (quiz_prompt.txt)
86
- const content = "..." // isi dengan dokumen yang sudah di ekstrak (PDF, TXT, DOCX)
87
-
88
- async function generateEducationalContent() {
89
- try {
90
- // 1. Generate Notes
91
- const notesResponse = await client.chatCompletion({
92
- model: "meta-llama/Llama-3.1-70B-Instruct",
93
- messages: [
94
- { role: "system", content: notes_prompt },
95
- { role: "user", content: content }
96
- ],
97
- temperature: 0.3,
98
- max_tokens: 10_000
99
- });
100
-
101
- const notesMd = notesResponse.choices[0].message.content;
102
- console.log("=== CATATAN ===");
103
- console.log(notesMd);
104
-
105
- // 2. Generate Flashcards
106
- const flashcardsResponse = await client.chatCompletion({
107
- model: "meta-llama/Llama-3.1-70B-Instruct",
108
- messages: [
109
- { role: "system", content: flashcards_prompt },
110
- { role: "user", content: notesMd }
111
- ],
112
- temperature: 0.3,
113
- max_tokens: 1024
114
- });
115
-
116
- const flashcardsMd = flashcardsResponse.choices[0].message.content;
117
- console.log("\n=== FLASHCARDS ===");
118
- console.log(flashcardsMd);
119
-
120
- // 3. Generate Quiz
121
- const quizResponse = await client.chatCompletion({
122
- model: "meta-llama/Llama-3.1-70B-Instruct",
123
- messages: [
124
- { role: "system", content: quiz_prompt },
125
- { role: "user", content: notesMd }
126
- ],
127
- temperature: 0.3,
128
- max_tokens: 5048
129
- });
130
-
131
- const quizMd = quizResponse.choices[0].message.content;
132
- console.log("\n=== KUIS ===");
133
- console.log(quizMd);
134
-
135
- } catch (error) {
136
- console.error("Error:", error);
137
- }
138
- }
139
-
140
- // Eksekusi fungsi utama
141
- generateEducationalContent();
142
- ```
143
-
144
- Pastikan anda menginstall dependency yang diperlukan:
145
- ```node.js
146
- npm install @huggingface/inference
147
- ```
148
-