shibatch commited on
Commit
8949da7
·
verified ·
1 Parent(s): 64d8472

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +3 -12
README.md CHANGED
@@ -169,13 +169,14 @@ The model can generate TinyStories-like text fragments, but repetitions and temp
169
 
170
  ```python
171
  import torch
172
- from transformers import AutoTokenizer, Gemma4ForCausalLM
173
 
174
  repo = "shibatch/tinygemma4text3m"
175
 
176
- tokenizer = AutoTokenizer.from_pretrained(repo)
177
  model = Gemma4ForCausalLM.from_pretrained(
178
  repo,
 
179
  torch_dtype=torch.float32,
180
  )
181
  model.eval()
@@ -195,16 +196,6 @@ with torch.no_grad():
195
  print(tokenizer.decode(output_ids[0], skip_special_tokens=True))
196
  ```
197
 
198
- If the model files are stored under an `hf/` subdirectory in the repository, use:
199
-
200
- ```python
201
- tokenizer = AutoTokenizer.from_pretrained(repo, subfolder="hf")
202
- model = Gemma4ForCausalLM.from_pretrained(
203
- repo,
204
- subfolder="hf",
205
- torch_dtype=torch.float32,
206
- )
207
- ```
208
 
209
  ## Loading with Transformers
210
 
 
169
 
170
  ```python
171
  import torch
172
+ from transformers import PreTrainedTokenizerFast, Gemma4ForCausalLM
173
 
174
  repo = "shibatch/tinygemma4text3m"
175
 
176
+ tokenizer = PreTrainedTokenizerFast.from_pretrained(repo, subfolder="hf")
177
  model = Gemma4ForCausalLM.from_pretrained(
178
  repo,
179
+ subfolder="hf",
180
  torch_dtype=torch.float32,
181
  )
182
  model.eval()
 
196
  print(tokenizer.decode(output_ids[0], skip_special_tokens=True))
197
  ```
198
 
 
 
 
 
 
 
 
 
 
 
199
 
200
  ## Loading with Transformers
201