nzros commited on
Commit
3f33e43
·
verified ·
1 Parent(s): 2ee8954

commit con Fix model card: license field, PEFT quick start

Browse files
Files changed (1) hide show
  1. README.md +21 -18
README.md CHANGED
@@ -8,33 +8,39 @@ tags:
8
  - sft
9
  - transformers
10
  - trl
11
- licence: license
12
  pipeline_tag: text-generation
13
  ---
14
 
15
  # Model Card for gemma4-code-assistant
16
 
17
- This model is a fine-tuned version of [google/gemma-4-E2B](https://huggingface.co/google/gemma-4-E2B).
18
- It has been trained using [TRL](https://github.com/huggingface/trl).
19
 
20
  ## Quick start
21
 
22
- ```python
23
- from transformers import pipeline
24
 
25
- question = "If you had a time machine, but could only go to the past or the future once and never return, which would you choose and why?"
26
- generator = pipeline("text-generation", model="None", device="cuda")
27
- output = generator([{"role": "user", "content": question}], max_new_tokens=128, return_full_text=False)[0]
28
- print(output["generated_text"])
 
 
 
 
 
 
 
 
 
 
 
 
29
  ```
30
 
31
  ## Training procedure
32
 
33
-
34
-
35
-
36
-
37
- This model was trained with SFT.
38
 
39
  ### Framework versions
40
 
@@ -47,10 +53,6 @@ This model was trained with SFT.
47
 
48
  ## Citations
49
 
50
-
51
-
52
- Cite TRL as:
53
-
54
  ```bibtex
55
  @software{vonwerra2020trl,
56
  title = {{TRL: Transformers Reinforcement Learning}},
@@ -59,4 +61,5 @@ Cite TRL as:
59
  url = {https://github.com/huggingface/trl},
60
  year = {2020}
61
  }
 
62
  ```
 
8
  - sft
9
  - transformers
10
  - trl
11
+ license: gemma
12
  pipeline_tag: text-generation
13
  ---
14
 
15
  # Model Card for gemma4-code-assistant
16
 
17
+ This model is a fine-tuned version of [google/gemma-4-E2B](https://huggingface.co/google/gemma-4-E2B), specialized for code assistance tasks. It was trained with supervised fine-tuning (SFT) using [TRL](https://github.com/huggingface/trl) and published by [DevNexAI](https://huggingface.co/Devnexai).
 
18
 
19
  ## Quick start
20
 
21
+ This is a LoRA adapter — load the base model first and apply the adapter on top:
 
22
 
23
+ ```python
24
+ from peft import PeftModel
25
+ from transformers import AutoModelForCausalLM, AutoTokenizer
26
+
27
+ base = AutoModelForCausalLM.from_pretrained(
28
+ "google/gemma-4-E2B", device_map="auto"
29
+ )
30
+ model = PeftModel.from_pretrained(base, "Devnexai/gemma4-code-assistant")
31
+ tokenizer = AutoTokenizer.from_pretrained("Devnexai/gemma4-code-assistant")
32
+
33
+ messages = [{"role": "user", "content": "Write a Python function to check if a string is a palindrome."}]
34
+ inputs = tokenizer.apply_chat_template(
35
+ messages, add_generation_prompt=True, return_tensors="pt"
36
+ ).to(model.device)
37
+ output = model.generate(inputs, max_new_tokens=256)
38
+ print(tokenizer.decode(output[0][inputs.shape[-1]:], skip_special_tokens=True))
39
  ```
40
 
41
  ## Training procedure
42
 
43
+ This model was trained with SFT (LoRA/PEFT).
 
 
 
 
44
 
45
  ### Framework versions
46
 
 
53
 
54
  ## Citations
55
 
 
 
 
 
56
  ```bibtex
57
  @software{vonwerra2020trl,
58
  title = {{TRL: Transformers Reinforcement Learning}},
 
61
  url = {https://github.com/huggingface/trl},
62
  year = {2020}
63
  }
64
+ ```
65
  ```