Update README.md
Browse files
README.md
CHANGED
@@ -44,4 +44,37 @@ base_model: akameswa/mistral-7b-instruct-v0.2-bnb-16bit
|
|
44 |
parameters:
|
45 |
normalize: true
|
46 |
dtype: float16
|
47 |
-
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
parameters:
|
45 |
normalize: true
|
46 |
dtype: float16
|
47 |
+
```
|
48 |
+
|
49 |
+
## Inference
|
50 |
+
```python
|
51 |
+
from unsloth import FastLanguageModel
|
52 |
+
import torch
|
53 |
+
|
54 |
+
model, tokenizer = FastLanguageModel.from_pretrained(
|
55 |
+
model_name = "akameswa/mistral-7b-instruct-code-ties",
|
56 |
+
max_seq_length = 2048,
|
57 |
+
)
|
58 |
+
|
59 |
+
xlcost_prompt = """Below is a description of a programming task. Write a response that appropriately completes the task based on the given description.
|
60 |
+
|
61 |
+
### Description:
|
62 |
+
{}
|
63 |
+
|
64 |
+
### Code:
|
65 |
+
{}"""
|
66 |
+
|
67 |
+
FastLanguageModel.for_inference(model)
|
68 |
+
inputs = tokenizer(
|
69 |
+
[
|
70 |
+
xlcost_prompt.format(
|
71 |
+
"Continue the fibonnaci sequence.",
|
72 |
+
"",
|
73 |
+
)
|
74 |
+
], return_tensors = "pt").to("cuda")
|
75 |
+
|
76 |
+
outputs = model.generate(**inputs, max_new_tokens = 64, use_cache = True)
|
77 |
+
tokenizer.batch_decode(outputs)
|
78 |
+
```
|
79 |
+
|
80 |
+
* [Link to inference notebook](https://github.com/akameswa/CodeGenerationMoE/blob/main/code/inference_merge.ipynb)
|