File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -334,21 +334,21 @@ PyTorch and TensorFlow: any model saved as before can be loaded back either in P
334
334
If you would like to load your saved model in the other framework, first make sure it is installed:
335
335
336
336
``` bash
337
- pip install tensorflow
338
- ===PT-TF-SPLIT===
339
337
pip install torch
338
+ ===PT-TF-SPLIT===
339
+ pip install tensorflow
340
340
```
341
341
342
342
Then, use the corresponding Auto class to load it like this:
343
343
344
344
``` py
345
- >> > from transformers import TFAutoModel
346
- >> > tokenizer = AutoTokenizer.from_pretrained(pt_save_directory)
347
- >> > tf_model = TFAutoModel.from_pretrained(pt_save_directory, from_pt = True )
348
- == = PT - TF - SPLIT == =
349
345
>> > from transformers import AutoModel
350
346
>> > tokenizer = AutoTokenizer.from_pretrained(tf_save_directory)
351
347
>> > pt_model = AutoModel.from_pretrained(tf_save_directory, from_tf = True )
348
+ == = PT - TF - SPLIT == =
349
+ >> > from transformers import TFAutoModel
350
+ >> > tokenizer = AutoTokenizer.from_pretrained(pt_save_directory)
351
+ >> > tf_model = TFAutoModel.from_pretrained(pt_save_directory, from_pt = True )
352
352
```
353
353
354
354
Lastly, you can also ask the model to return all hidden states and all attention weights if you need them:
You can’t perform that action at this time.
0 commit comments