GGUF
conversational
kishida commited on
Commit
265c2d2
·
verified ·
1 Parent(s): e0cd455

readme追加

Browse files
Files changed (1) hide show
  1. README.md +65 -1
README.md CHANGED
@@ -4,4 +4,68 @@ datasets:
4
  - kishida/CompileError-Java-JP-cheerful
5
  base_model:
6
  - unsloth/Qwen3-4B-Instruct-2507-GGUF
7
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  - kishida/CompileError-Java-JP-cheerful
5
  base_model:
6
  - unsloth/Qwen3-4B-Instruct-2507-GGUF
7
+ ---
8
+
9
+ Javaのコンパイルエラーを明るく解説します。
10
+
11
+ ```python
12
+ from llama_cpp import Llama
13
+
14
+ # model load
15
+ base_model = "qwen3-4b"
16
+ quant = "Q4_K_M"
17
+ llm = Llama.from_pretrained(
18
+ repo_id=f"kishida/java-error-explainer-jp-cheerful-{base_model}",
19
+ filename=f"java-error-explainer-jp-cheerful-{base_model}.{quant}.gguf",
20
+ seed=1234,
21
+ )
22
+
23
+ # streaming
24
+ def chat(msg):
25
+ res = llm.create_chat_completion(
26
+ messages=[
27
+ {"role": "system", "content": "You are a Java compile error explainer."},
28
+ {"role": "user", "content": msg},
29
+ ],
30
+ temperature=0.7,
31
+ )
32
+ return res["choices"][0]["message"]["content"]
33
+
34
+ source = """
35
+ void main() {
36
+ IO.println(LocalDateTime.now());
37
+ IO.println("Hello")
38
+ }
39
+ """
40
+
41
+ error = """
42
+ HelloWithError.java:3: エラー: ';'がありません
43
+ IO.println("Hello")
44
+ ^
45
+ エラー1個
46
+ """
47
+
48
+ template = """
49
+ source:
50
+ {}
51
+
52
+ compile error:
53
+ {}
54
+ """
55
+
56
+ print("source + error")
57
+ print(chat(template.format(source, error)))
58
+ """
59
+ あら、コンパイルエラーだね〜!これは単純なセミコロンの不足でしょ。
60
+
61
+ 3行目のコード「IO.println("Hello")」の最後にセミコロン(;)がついていないのが原因よ。Javaでは、一行の文を終わらせるために必ずセミコロンが必要なの。
62
+
63
+ このエラーを解決するには、3行目のコードの最後に「;」を追加して「IO.println("Hello");」にするだけなの。とても簡単な修正だから、大丈夫だと思うよ〜!
64
+ """
65
+
66
+ print("error only")
67
+ print(chat(error))
68
+ """
69
+ あら、このコードに問題が見えるわ!`IO.println("Hello")`の行でセミコロンの忘れちゃってるのね。Javaでは文末には必ずセミコロンを付けないといけないんだから。この一行を`IO.println("Hello");`に直せばエラーは消えるわ。プログラミング、結構気をつけてね!
70
+ """
71
+ ```