Text Generation
Transformers
Safetensors
English
llama
conversational
text-generation-inference
lucifertrj commited on
Commit
58d4a76
Β·
verified Β·
1 Parent(s): bad0cac

add inference script

Browse files
Files changed (1) hide show
  1. README.md +36 -0
README.md CHANGED
@@ -19,6 +19,42 @@ base_model: codellama/CodeLlama-13b-Instruct-hf
19
 
20
  πŸ€– Model Description: Panda-Coder is a state-of-the-art LLM, a fine-tuned model, specifically designed to generate code based on natural language instructions. It's the result of relentless innovation and meticulous fine-tuning, all to make coding easier and more accessible for everyone.
21
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  ## πŸ”— Key Features:
23
 
24
  🌟 NLP-Based Coding: With Panda-Coder, you can transform your plain text instructions into functional code effortlessly. No need to grapple with syntax and semantics - it understands your language.
 
19
 
20
  πŸ€– Model Description: Panda-Coder is a state-of-the-art LLM, a fine-tuned model, specifically designed to generate code based on natural language instructions. It's the result of relentless innovation and meticulous fine-tuning, all to make coding easier and more accessible for everyone.
21
 
22
+ ## Inference
23
+
24
+ ```python
25
+ import torch
26
+ import transformers
27
+ from transformers import AutoModelForCausalLM, AutoTokenizer, TrainingArguments,BitsAndBytesConfig
28
+
29
+ prompt = f"""### Instruction:
30
+ Below is an instruction that describes a task. Write a response that appropriately completes the request.
31
+
32
+ Write a Python quickstart script to get started with TensorFlow
33
+
34
+ ### Input:
35
+
36
+ ### Response:
37
+ """
38
+
39
+ input_ids = tokenizer(prompt, return_tensors="pt", truncation=True).input_ids.cuda()
40
+ outputs = base_model.generate(input_ids=input_ids, max_new_tokens=512, do_sample=True, top_p=0.9,temperature=0.1,repetition_penalty=1.1)
41
+
42
+ print(f"Output:\n{tokenizer.batch_decode(outputs.detach().cpu().numpy(), skip_special_tokens=True)[0][len(prompt):]}")
43
+ ```
44
+
45
+ Output
46
+
47
+ ```bash
48
+ Output:
49
+ import tensorflow as tf
50
+
51
+ # Create a constant tensor
52
+ hello_constant = tf.constant('Hello, World!')
53
+
54
+ # Print the value of the constant
55
+ print(hello_constant)
56
+ ```
57
+
58
  ## πŸ”— Key Features:
59
 
60
  🌟 NLP-Based Coding: With Panda-Coder, you can transform your plain text instructions into functional code effortlessly. No need to grapple with syntax and semantics - it understands your language.