We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi, Sorry if I'm missing something but I'm getting the error TypeError: tuple indices must be integers or slices, not tuple. My code is:
TypeError: tuple indices must be integers or slices, not tuple
import torch from torch import Tensor from self_rewarding_lm_pytorch import ( SelfRewardingTrainer, create_mock_dataset ) from x_transformers import TransformerWrapper, Decoder from transformers import AutoModelForCausalLM, AutoTokenizer model = AutoModelForCausalLM.from_pretrained('distilgpt2') tokenizer = AutoTokenizer.from_pretrained('distilgpt2') sft_dataset = create_mock_dataset(10, lambda: (torch.randint(0, 256, (256,)), torch.tensor(1))) prompt_dataset = create_mock_dataset(10, lambda: 'mock prompt') def decode_tokens(tokens: Tensor) -> str: return tokenizer.decode(tokens) def encode_str(seq_str: str) -> Tensor: return tokenizer(seq_str, return_tensors='pt')['input_ids'][0] trainer = SelfRewardingTrainer( model.transformer, finetune_configs = dict( train_sft_dataset = sft_dataset, self_reward_prompt_dataset = prompt_dataset, dpo_num_train_steps = 1000 ), tokenizer_decode = decode_tokens, tokenizer_encode = encode_str, accelerate_kwargs = dict( ) ) trainer(overwrite_checkpoints = True)
Thanks
The text was updated successfully, but these errors were encountered:
Could you share the error log for assistance? It's hard to provide guidance without more details. Thanks!
Sorry, something went wrong.
No branches or pull requests
Hi,
Sorry if I'm missing something but I'm getting the error
TypeError: tuple indices must be integers or slices, not tuple
.My code is:
Thanks
The text was updated successfully, but these errors were encountered: