TechxGenus commited on
Commit
890f377
1 Parent(s): d31c9c6

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +71 -0
README.md ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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-7b/resolve/main/CodeGemma.jpg">
14
+ </p>
15
+ AWQ quantized version of CodeGemma-7b model.
16
+
17
+ ---
18
+
19
+ ### CodeGemma
20
+
21
+ 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).
22
+
23
+ ### Usage
24
+
25
+ Here give some examples of how to use our model:
26
+
27
+ ```python
28
+ from transformers import AutoTokenizer, AutoModelForCausalLM
29
+ import torch
30
+ PROMPT = """### Instruction
31
+ {instruction}
32
+ ### Response
33
+ """
34
+ instruction = <Your code instruction here>
35
+ prompt = PROMPT.format(instruction=instruction)
36
+ tokenizer = AutoTokenizer.from_pretrained("TechxGenus/CodeGemma-7b")
37
+ model = AutoModelForCausalLM.from_pretrained(
38
+ "TechxGenus/CodeGemma-7b",
39
+ torch_dtype=torch.bfloat16,
40
+ device_map="auto",
41
+ )
42
+ inputs = tokenizer.encode(prompt, return_tensors="pt")
43
+ outputs = model.generate(input_ids=inputs.to(model.device), max_new_tokens=2048)
44
+ print(tokenizer.decode(outputs[0]))
45
+ ```
46
+
47
+ With text-generation pipeline:
48
+
49
+
50
+ ```python
51
+ from transformers import pipeline
52
+ import torch
53
+ PROMPT = """<bos>### Instruction
54
+ {instruction}
55
+ ### Response
56
+ """
57
+ instruction = <Your code instruction here>
58
+ prompt = PROMPT.format(instruction=instruction)
59
+ generator = pipeline(
60
+ model="TechxGenus/CodeGemma-7b",
61
+ task="text-generation",
62
+ torch_dtype=torch.bfloat16,
63
+ device_map="auto",
64
+ )
65
+ result = generator(prompt, max_length=2048)
66
+ print(result[0]["generated_text"])
67
+ ```
68
+
69
+ ### Note
70
+
71
+ 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.