Run this model with HF Jobs
Run MilaDeepGraph/ProtST-ESM1b-LocalizationPrediction on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/MilaDeepGraph/ProtST-ESM1b-LocalizationPrediction. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/MilaDeepGraph/ProtST-ESM1b-LocalizationPrediction on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use MilaDeepGraph/ProtST-ESM1b-LocalizationPrediction with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use MilaDeepGraph/ProtST-ESM1b-LocalizationPrediction with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="MilaDeepGraph/ProtST-ESM1b-LocalizationPrediction", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("MilaDeepGraph/ProtST-ESM1b-LocalizationPrediction", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Update README.md
#4
by Jiqing - opened
77 unmodified lines787980818283848518 unmodified lines1041051061071081091101115 unmodified lines1171181191201211221231249 unmodified lines1341351361371381391401412 unmodified lines14414514614714814915015115215315415515615715815977 unmodified lines"lr": training_args.learning_rate * lr_ratio},]- optimizer_cls, optimizer_kwargs = Trainer.get_optimizer_cls_and_kwargs(training_args)+ optimizer_cls, optimizer_kwargs = GaudiTrainer.get_optimizer_cls_and_kwargs(training_args)optimizer = optimizer_cls(optimizer_grouped_parameters, **optimizer_kwargs)return optimizer18 unmodified linesif __name__ == "__main__":- device = torch.device("cpu")+ device = torch.device("hpu")raw_dataset = load_dataset("Jiqing/ProtST-BinaryLocalization")model = AutoModel.from_pretrained("Jiqing/protst-esm1b-for-sequential-classification", trust_remote_code=True, torch_dtype=torch.bfloat16).to(device)tokenizer = AutoTokenizer.from_pretrained("facebook/esm1b_t33_650M_UR50S")5 unmodified lines'dataloader_num_workers': 0, 'run_name': 'downstream_esm1b_localization_fix', 'optim': 'adamw_torch', 'resume_from_checkpoint': False, \- 'label_names': ['labels'], 'load_best_model_at_end': True, 'metric_for_best_model': 'accuracy', 'bf16': True, "save_total_limit": 3}+ 'label_names': ['labels'], 'load_best_model_at_end': True, 'metric_for_best_model': 'accuracy', 'bf16': True, "save_total_limit": 3, "use_habana":True, "use_lazy_mode": True, "use_hpu_graphs_for_inference": True}- training_args = HfArgumentParser(TrainingArguments).parse_dict(training_args, allow_extra_keys=False)[0]+ training_args = HfArgumentParser(GaudiTrainingArguments).parse_dict(training_args, allow_extra_keys=False)[0]def tokenize_protein(example, tokenizer=None):protein_seq = example["prot_seq"]9 unmodified linesfor split in ["train", "validation", "test"]:raw_dataset[split] = raw_dataset[split].map(func_tokenize_protein, batched=False, remove_columns=["Unnamed: 0", "prot_seq", "localization"])- data_collator = DataCollatorWithPadding(tokenizer=tokenizer)+ data_collator = DataCollatorWithPadding(tokenizer=tokenizer, padding="max_length", max_length=1024)transformers.utils.logging.set_verbosity_info()log_level = training_args.get_process_log_level()2 unmodified linesoptimizer = create_optimizer(model)scheduler = create_scheduler(training_args, optimizer)+ gaudi_config = GaudiConfig()+ gaudi_config.use_fused_adam = True+ gaudi_config.use_fused_clip_norm =True# build trainer- trainer = Trainer(+ trainer = GaudiTrainer(model=model,+ gaudi_config=gaudi_config,args=training_args,train_dataset=raw_dataset["train"],eval_dataset=raw_dataset["validation"],77 unmodified lines787980818283848518 unmodified lines1041051061071081091101115 unmodified lines1171181191201211221231249 unmodified lines1341351361371381391401412 unmodified lines14414514614714814915015115215315415515615715815977 unmodified lines"lr": training_args.learning_rate * lr_ratio},]- optimizer_cls, optimizer_kwargs = Trainer.get_optimizer_cls_and_kwargs(training_args)+ optimizer_cls, optimizer_kwargs = GaudiTrainer.get_optimizer_cls_and_kwargs(training_args)optimizer = optimizer_cls(optimizer_grouped_parameters, **optimizer_kwargs)return optimizer18 unmodified linesif __name__ == "__main__":- device = torch.device("cpu")+ device = torch.device("hpu")raw_dataset = load_dataset("Jiqing/ProtST-BinaryLocalization")model = AutoModel.from_pretrained("Jiqing/protst-esm1b-for-sequential-classification", trust_remote_code=True, torch_dtype=torch.bfloat16).to(device)tokenizer = AutoTokenizer.from_pretrained("facebook/esm1b_t33_650M_UR50S")5 unmodified lines'dataloader_num_workers': 0, 'run_name': 'downstream_esm1b_localization_fix', 'optim': 'adamw_torch', 'resume_from_checkpoint': False, \- 'label_names': ['labels'], 'load_best_model_at_end': True, 'metric_for_best_model': 'accuracy', 'bf16': True, "save_total_limit": 3}+ 'label_names': ['labels'], 'load_best_model_at_end': True, 'metric_for_best_model': 'accuracy', 'bf16': True, "save_total_limit": 3, "use_habana":True, "use_lazy_mode": True, "use_hpu_graphs_for_inference": True}- training_args = HfArgumentParser(TrainingArguments).parse_dict(training_args, allow_extra_keys=False)[0]+ training_args = HfArgumentParser(GaudiTrainingArguments).parse_dict(training_args, allow_extra_keys=False)[0]def tokenize_protein(example, tokenizer=None):protein_seq = example["prot_seq"]9 unmodified linesfor split in ["train", "validation", "test"]:raw_dataset[split] = raw_dataset[split].map(func_tokenize_protein, batched=False, remove_columns=["Unnamed: 0", "prot_seq", "localization"])- data_collator = DataCollatorWithPadding(tokenizer=tokenizer)+ data_collator = DataCollatorWithPadding(tokenizer=tokenizer, padding="max_length", max_length=1024)transformers.utils.logging.set_verbosity_info()log_level = training_args.get_process_log_level()2 unmodified linesoptimizer = create_optimizer(model)scheduler = create_scheduler(training_args, optimizer)+ gaudi_config = GaudiConfig()+ gaudi_config.use_fused_adam = True+ gaudi_config.use_fused_clip_norm =True# build trainer- trainer = Trainer(+ trainer = GaudiTrainer(model=model,+ gaudi_config=gaudi_config,args=training_args,train_dataset=raw_dataset["train"],eval_dataset=raw_dataset["validation"],
README.md+14-14