kr-manish commited on
Commit
38ea445
1 Parent(s): 4605b15

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +20 -19
README.md CHANGED
@@ -16,30 +16,31 @@ license: other
16
 
17
  This model was trained using AutoTrain. For more information, please visit [AutoTrain](https://hf.co/docs/autotrain).
18
 
 
 
 
 
19
  # Usage
20
 
21
  ```python
22
 
23
  from transformers import AutoModelForCausalLM, AutoTokenizer
24
 
25
- model_path = "PATH_TO_THIS_REPO"
26
-
27
  tokenizer = AutoTokenizer.from_pretrained(model_path)
28
- model = AutoModelForCausalLM.from_pretrained(
29
- model_path,
30
- device_map="auto",
31
- torch_dtype='auto'
32
- ).eval()
33
-
34
- # Prompt content: "hi"
35
- messages = [
36
- {"role": "user", "content": "hi"}
37
- ]
38
-
39
- input_ids = tokenizer.apply_chat_template(conversation=messages, tokenize=True, add_generation_prompt=True, return_tensors='pt')
40
- output_ids = model.generate(input_ids.to('cuda'))
41
- response = tokenizer.decode(output_ids[0][input_ids.shape[1]:], skip_special_tokens=True)
42
-
43
- # Model response: "Hello! How can I assist you today?"
44
- print(response)
45
  ```
 
16
 
17
  This model was trained using AutoTrain. For more information, please visit [AutoTrain](https://hf.co/docs/autotrain).
18
 
19
+ Dataset used: codeparrot/xlcost-text-to-code
20
+
21
+ github: https://github.com/manishzed/LLM-Fine-tune
22
+
23
  # Usage
24
 
25
  ```python
26
 
27
  from transformers import AutoModelForCausalLM, AutoTokenizer
28
 
29
+ model_path = "kr-manish/Mistral-7B-autotrain-text-python-vf1"
 
30
  tokenizer = AutoTokenizer.from_pretrained(model_path)
31
+ model = AutoModelForCausalLM.from_pretrained(model_path)
32
+
33
+ #input_text = "Maximum Prefix Sum possible by merging two given arrays | Python3 implementation of the above approach ; Stores the maximum prefix sum of the array A [ ] ; Traverse the array A [ ] ; Stores the maximum prefix sum of the array B [ ] ; Traverse the array B [ ] ;"
34
+ input_text ="Program to convert Centimeters to Pixels | Function to convert centimeters to pixels ; Driver Code"
35
+ # Tokenize input text
36
+ input_ids = tokenizer.encode(input_text, return_tensors="pt")
37
+
38
+ # Generate output text
39
+ output = model.generate(input_ids, max_length=1024, num_return_sequences=1, do_sample=True)
40
+
41
+ # Decode and print output
42
+ generated_text = tokenizer.decode(output[0], skip_special_tokens=True)
43
+ print(generated_text)
44
+
45
+ #Program to convert Centimeters to Pixels | Function to convert centimeters to pixels ; Driver Code [/INST] def cmToPixels ( cm ) : NEW_LINE INDENT return ( ( cm * 100 ) / 17 ) NEW_LINE DEDENT cm = 105.25 NEW_LINE print ( round ( cmToPixels ( cm ) , 3 ) ) NEW_LINE
 
 
46
  ```