Understanding writing style in social media with a supervised contrastively pre-trained transformer
Paper • 2310.11081 • Published
Run AIDA-UPM/star 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:
Use HF Jobs to fine-tune https://huggingface.co/AIDA-UPM/star. 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.
Use HF Jobs to run batch inference with https://huggingface.co/AIDA-UPM/star 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.
How to use AIDA-UPM/star with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("feature-extraction", model="AIDA-UPM/star") # pip install -U transformers accelerate
# Load model directly
from transformers import AutoTokenizer, AutoModel
tokenizer = AutoTokenizer.from_pretrained("AIDA-UPM/star")
model = AutoModel.from_pretrained("AIDA-UPM/star", device_map="auto")# pip install -U transformers accelerate
# Load model directly
from transformers import AutoTokenizer, AutoModel
tokenizer = AutoTokenizer.from_pretrained("AIDA-UPM/star")
model = AutoModel.from_pretrained("AIDA-UPM/star", device_map="auto")This is the repository for the Style Transformer for Authorship Representations (STAR) model. We present the weights of our model here.
Also check out our github repo for STAR for replication.
tokenizer = AutoTokenizer.from_pretrained('roberta-large')
model = AutoModel.from_pretrained('AIDA-UPM/star')
examples = ['My text 1', 'This is another text']
def extract_embeddings(texts):
encoded_texts = tokenizer(texts)
with torch.no_grad():
style_embeddings = model(encoded_texts.input_ids,
attention_mask=encoded_texts.attention_mask).pooler_output
return style_embeddings
print(extract_embeddings(examples))
@article{Huertas-Tato2023Oct,
author = {Huertas-Tato, Javier and Martin, Alejandro and Camacho, David},
title = {{Understanding writing style in social media with a supervised contrastively pre-trained transformer}},
journal = {arXiv},
year = {2023},
month = oct,
eprint = {2310.11081},
doi = {10.48550/arXiv.2310.11081}
}
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="AIDA-UPM/star")