TechxGenus commited on
Commit
ab464c8
·
verified ·
1 Parent(s): b20373e

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +63 -0
README.md CHANGED
@@ -1,5 +1,68 @@
1
  ---
 
 
 
 
 
2
  license: other
3
  license_name: gemma-terms-of-use
4
  license_link: https://ai.google.dev/gemma/terms
5
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ tags:
3
+ - code
4
+ - gemma
5
+ library_name: transformers
6
+ pipeline_tag: text-generation
7
  license: other
8
  license_name: gemma-terms-of-use
9
  license_link: https://ai.google.dev/gemma/terms
10
  ---
11
+
12
+ <p align="center">
13
+ <img width="300px" alt="CodeGemma" src="https://huggingface.co/TechxGenus/CodeGemma-2b/resolve/main/CodeGemma.jpg">
14
+ </p>
15
+
16
+ ### CodeGemma
17
+
18
+ We've fine-tuned Gemma-7b with an additional 0.7 billion high-quality, code-related tokens for 3 epochs. We used DeepSpeed ZeRO 3 and Flash Attention 2 to accelerate the training process. It achieves **67.7 pass@1** on HumanEval-Python. This model operates using the Alpaca instruction format (excluding the system prompt).
19
+
20
+ ### Usage
21
+
22
+ Here give some examples of how to use our model:
23
+
24
+ ```python
25
+ from transformers import AutoTokenizer, AutoModelForCausalLM
26
+ import torch
27
+ PROMPT = """### Instruction
28
+ {instruction}
29
+ ### Response
30
+ """
31
+ instruction = <Your code instruction here>
32
+ prompt = PROMPT.format(instruction=instruction)
33
+ tokenizer = AutoTokenizer.from_pretrained("TechxGenus/CodeGemma-2b")
34
+ model = AutoModelForCausalLM.from_pretrained(
35
+ "TechxGenus/CodeGemma-2b",
36
+ torch_dtype=torch.bfloat16,
37
+ device_map="auto",
38
+ )
39
+ inputs = tokenizer.encode(prompt, return_tensors="pt")
40
+ outputs = model.generate(input_ids=inputs.to(model.device), max_new_tokens=2048)
41
+ print(tokenizer.decode(outputs[0]))
42
+ ```
43
+
44
+ With text-generation pipeline:
45
+
46
+
47
+ ```python
48
+ from transformers import pipeline
49
+ import torch
50
+ PROMPT = """<bos>### Instruction
51
+ {instruction}
52
+ ### Response
53
+ """
54
+ instruction = <Your code instruction here>
55
+ prompt = PROMPT.format(instruction=instruction)
56
+ generator = pipeline(
57
+ model="TechxGenus/CodeGemma-2b",
58
+ task="text-generation",
59
+ torch_dtype=torch.bfloat16,
60
+ device_map="auto",
61
+ )
62
+ result = generator(prompt, max_length=2048)
63
+ print(result[0]["generated_text"])
64
+ ```
65
+
66
+ ### Note
67
+
68
+ Model may sometimes make errors, produce misleading contents, or struggle to manage tasks that are not related to coding. It has undergone very limited testing. Additional safety testing should be performed before any real-world deployments.