kishida commited on
Commit
1448259
·
verified ·
1 Parent(s): 56e3a95

update readme

Browse files
Files changed (1) hide show
  1. README.md +64 -1
README.md CHANGED
@@ -6,4 +6,67 @@ language:
6
  - ja
7
  base_model:
8
  - unsloth/Ministral-3-3B-Instruct-2512
9
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  - ja
7
  base_model:
8
  - unsloth/Ministral-3-3B-Instruct-2512
9
+ ---
10
+
11
+ Javaのコンパイルエラーを明るく解説します。
12
+ まだ壊れています。
13
+
14
+ ```python
15
+ from llama_cpp import Llama
16
+
17
+ # model load
18
+ base_model = "ministral3-3b"
19
+ quant = "Q8_0"
20
+ llm = Llama.from_pretrained(
21
+ repo_id=f"kishida/java-error-explainer-jp-cheerful-{base_model}",
22
+ filename=f"java-error-explainer-jp-cheerful-{base_model}.{quant}.gguf",
23
+ seed=1234,
24
+ )
25
+
26
+ # streaming
27
+ def chat(msg):
28
+ res = llm.create_chat_completion(
29
+ messages=[
30
+ {"role": "system", "content": "You are a Java compile error explainer."},
31
+ {"role": "user", "content": msg},
32
+ ],
33
+ temperature=0.7,
34
+ )
35
+ return res["choices"][0]["message"]["content"]
36
+
37
+ source = """
38
+ void main() {
39
+ IO.println(LocalDateTime.now());
40
+ IO.println("Hello")
41
+ }
42
+ """
43
+
44
+ error = """
45
+ HelloWithError.java:3: エラー: ';'がありません
46
+ IO.println("Hello")
47
+ ^
48
+ エラー1個
49
+ """
50
+
51
+ template = """
52
+ source:
53
+ {}
54
+
55
+ compile error:
56
+ {}
57
+ """
58
+
59
+ print("source + error")
60
+ print(chat(template.format(source, error)))
61
+ """
62
+ おっと、コードの行末にセミンカンのないからエラーになっちゃったね!Javaでは命令や文を終える時には「;」とせんせんなんか。この行のセミンは欠けてるから、コンパイダーさんが「;」って言ってるんだよ!行末にセニトンの付き忘れが大いな事!
63
+ """
64
+
65
+ print("error only")
66
+ print(chat(error))
67
+ """
68
+ おっと、コードの行末にセミンカンのないからエラーになっちゃったね!Javaでは命令や文を終える時には「;」とせんせんなんか。この行のセミンは欠けてるから、コンパイダーさんが「;」って言ってるんだよ!行末にセニトンの付き忘れが大いな事!
69
+ """
70
+
71
+ # 壊れてる?
72
+ ```