Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update conditioners.py #176

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

RoyalCities
Copy link

Fix T5-base tokenizer config loading

  • Use T5Tokenizer directly instead of AutoTokenizer
  • Add explicit tokenizer parameters
  • Disable auth checks for public models
  • Enable legacy mode for older T5 models

Autotokenizer now looks for tokenizer_config but this available for base t5 giving a 401 client error trying to load models.

Tested across inference to be working with existing models in both 16 and 32 bit but not training.....

Fix T5-base tokenizer config loading

- Use T5Tokenizer directly instead of AutoTokenizer
- Add explicit tokenizer parameters
- Disable auth checks for public models
- Enable legacy mode for older T5 models
# Model initialization with conditional precision
model = T5EncoderModel.from_pretrained(t5_model_name)
model = model.train(enable_grad).requires_grad_(enable_grad)
if enable_grad:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's this change for?


self.model.eval()

with torch.cuda.amp.autocast(dtype=torch.float16) and torch.set_grad_enabled(self.enable_grad):
with torch.cuda.amp.autocast(enabled=self.enable_grad, dtype=torch.float16 if self.enable_grad else torch.float32):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why would the autocast change based on the grad being enabled? I haven't used it in a long time, but I believe enable_grad was about fine-tuning the T5 model, shouldn't be related to autocasting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants