LE Quoc Dat commited on
Commit
b71aa35
1 Parent(s): 11119a7

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +8 -7
README.md CHANGED
@@ -17,7 +17,8 @@ tags:
17
  # FastApply-1.5B-v1.0
18
 
19
  [Github: kortix-ai/fast-apply](https://github.com/kortix-ai/fast-apply)
20
- [Dataset: Kortix/FastApply-dataset-v1.0](https://huggingface.co/datasets/Kortix/FastApply-dataset-v1.0)
 
21
 
22
  ## Model Details
23
 
@@ -81,7 +82,7 @@ To use the model, you can load it using the Hugging Face Transformers library:
81
  ```python
82
  from transformers import AutoModelForCausalLM, AutoTokenizer
83
 
84
- model = AutoModelForCausalLM.from_pretrained("Kortix/FastApply-1.5B-v1.0")
85
  tokenizer = AutoTokenizer.from_pretrained("Kortix/FastApply-1.5B-v1.0")
86
 
87
  # Prepare your input following the prompt structure mentioned above
@@ -104,15 +105,15 @@ Provide the complete updated code.<|im_end|>
104
  input_text = input_text.format(
105
  original_code=original_code,
106
  update_snippet=update_snippet,
107
- ).strip() + tokenizer.eos_token
108
 
109
  # Generate the response
110
  input_ids = tokenizer.encode(input_text, return_tensors="pt")
111
- output = model.generate(input_ids, max_length=8192)
112
- response = tokenizer.decode(output[0])
 
 
113
 
114
  # Extract the updated code from the response
115
  updated_code = response.split("<updated-code>")[1].split("</updated-code>")[0]
116
-
117
- print(updated_code)
118
  ```
 
17
  # FastApply-1.5B-v1.0
18
 
19
  [Github: kortix-ai/fast-apply](https://github.com/kortix-ai/fast-apply)
20
+ [Dataset: Kortix/FastApply-dataset-v1.0](https://huggingface.co/datasets/Kortix/FastApply-dataset-v1.0)
21
+ [Try it now on 👉 Google Colab](https://colab.research.google.com/drive/1BNCab4oK-xBqwFQD4kCcjKc7BPKivkm1?usp=sharing)
22
 
23
  ## Model Details
24
 
 
82
  ```python
83
  from transformers import AutoModelForCausalLM, AutoTokenizer
84
 
85
+ model = AutoModelForCausalLM.from_pretrained("Kortix/FastApply-1.5B-v1.0", device_map="auto")
86
  tokenizer = AutoTokenizer.from_pretrained("Kortix/FastApply-1.5B-v1.0")
87
 
88
  # Prepare your input following the prompt structure mentioned above
 
105
  input_text = input_text.format(
106
  original_code=original_code,
107
  update_snippet=update_snippet,
108
+ ).strip()
109
 
110
  # Generate the response
111
  input_ids = tokenizer.encode(input_text, return_tensors="pt")
112
+ output = model.generate(input_ids, max_length=8192,)
113
+
114
+ response = tokenizer.decode(output[0][len(input_ids[0]):])
115
+ print(response)
116
 
117
  # Extract the updated code from the response
118
  updated_code = response.split("<updated-code>")[1].split("</updated-code>")[0]
 
 
119
  ```