LaferriereJC
commited on
Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Trained on 554m tokens, 1 epoch, lr .00987
|
2 |
+
brown corpus
|
3 |
+
quotes (wikiquote, azquote, gracious quotes, english quotes)
|
4 |
+
idioms
|
5 |
+
defitions (wordnet)
|
6 |
+
wiki_text
|
7 |
+
mini pile
|
8 |
+
|
9 |
+
code: https://gist.github.com/thistleknot/368ab298edf596ef50d2cfdcbec66fd1
|
10 |
+
|
11 |
+
```
|
12 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
13 |
+
|
14 |
+
# Specify the path to the directory where the model is stored
|
15 |
+
#model_dir = r"C:\Users\User\Documents\wiki\wiki\data science\nlp\research\mamba_brown_trained_556m\mamba_brown_trained\mamba_brown_trained"
|
16 |
+
model_dir = "/home/user/mamba_brown_trained"
|
17 |
+
|
18 |
+
# Load the tokenizer from the local directory
|
19 |
+
# Load the tokenizer and model (use a causal language model for text generation)
|
20 |
+
tokenizer = AutoTokenizer.from_pretrained(model_dir)
|
21 |
+
model = AutoModelForCausalLM.from_pretrained(model_dir)
|
22 |
+
model.to('cuda')
|
23 |
+
|
24 |
+
# Now, you can use the model and tokenizer for inference
|
25 |
+
input_text = "Once upon a time"
|
26 |
+
|
27 |
+
# Tokenize the input
|
28 |
+
inputs = tokenizer(input_text, return_tensors="pt").to('cuda')
|
29 |
+
|
30 |
+
# Generate output tokens using the model
|
31 |
+
output_ids = model.generate(**inputs, max_length=50)
|
32 |
+
|
33 |
+
# Decode the generated token IDs back into text
|
34 |
+
decoded_output = tokenizer.decode(output_ids[0], skip_special_tokens=True)
|
35 |
+
|
36 |
+
# Print the generated output text
|
37 |
+
print(decoded_output)
|
38 |
+
```
|