nicholasKluge commited on
Commit
4736d3c
1 Parent(s): 9ec9054

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +23 -8
README.md CHANGED
@@ -51,7 +51,7 @@ This repository has 21 checkpoints, saved as revisions, that were logged during
51
 
52
  ## Details
53
 
54
- - **Size:** 162 million parameters
55
  - **Dataset:** [Portuguese-Corpus-v3](https://huggingface.co/datasets/nicholasKluge/portuguese-corpus-v3)
56
  - **Language:** Portuguese
57
  - **Number of steps:** 457,969
@@ -101,16 +101,31 @@ This repository has the [source code](https://github.com/Nkluge-correa/Aira) use
101
  ## Usage
102
 
103
  ```python
104
- # Use a pipeline as a high-level helper
105
- from transformers import pipeline
106
 
107
- pipe = pipeline("text-generation", model="nicholasKluge/Teeny-tiny-llama-162m")
 
 
108
 
109
- # Load model directly
110
- from transformers import AutoTokenizer, AutoModelForCausalLM
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
111
 
112
- tokenizer = AutoTokenizer.from_pretrained("nicholasKluge/Teeny-tiny-llama-162m")
113
- model = AutoModelForCausalLM.from_pretrained("nicholasKluge/Teeny-tiny-llama-162m")
114
  ```
115
 
116
  ## Limitations
 
51
 
52
  ## Details
53
 
54
+ - **Size:** 162,417,408 million parameters
55
  - **Dataset:** [Portuguese-Corpus-v3](https://huggingface.co/datasets/nicholasKluge/portuguese-corpus-v3)
56
  - **Language:** Portuguese
57
  - **Number of steps:** 457,969
 
101
  ## Usage
102
 
103
  ```python
104
+ from transformers import AutoTokenizer, AutoModelForCausalLM
105
+ import torch
106
 
107
+ # Load model and the tokenizer
108
+ tokenizer = AutoTokenizer.from_pretrained("nicholasKluge/Teeny-tiny-llama-162m", revision='main')
109
+ model = AutoModelForCausalLM.from_pretrained("nicholasKluge/Teeny-tiny-llama-162m", revision='main')
110
 
111
+ # Pass the model to your device
112
+ device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
113
+
114
+ model.eval()
115
+ model.to(device)
116
+
117
+ # Tokenize the inputs and pass them to the device
118
+ inputs = tokenizer("Astronomia é a ciência", return_tensors="pt").to(device)
119
+
120
+ # Generate some text
121
+ completions = model.generate(**inputs, num_return_sequences=2, max_new_tokens=100)
122
+
123
+ # Print the generated text
124
+ for i, completion in enumerate(completions):
125
+ print(f'🤖 {tokenizer.decode(completion)}')
126
+
127
+ >>> 🤖 <s> Astronomia é a ciência que estuda o universo e as leis da física e suas relações com os fenômenos naturais e seus efeitos sobre o meio ambiente e o homem. A astronomia é uma disciplina científica que se dedica à investigação de fenômenos astronômicos e ao estudo das propriedades dos objetos celestes.
128
 
 
 
129
  ```
130
 
131
  ## Limitations