Skip to content

Instantly share code, notes, and snippets.

View gsarti's full-sized avatar
📚
Learning

Gabriele Sarti gsarti

📚
Learning
View GitHub Profile
@gsarti
gsarti / calamita_2024_eureka_rebus_length_hint_config.py
Created September 13, 2024 14:55
Configuration for 2-shot verbalized rebus solving with length hints for the CALAMITA 2024 campaign
# Huggingface Hub ID of the dataset. If data is not on HF, set the variable to 'other'
# NOTE: Default config is used
DATA_HUB_ID = "gsarti/eureka-rebus-calamita-2024"
# Task type. Values accepted: multiple_choice, open-ended
OUTPUT_TYPE = "open-ended"
### Prompting details
# Template string used to compile the prompt. Use {{}} variables to fill using the dataset columns.
@gsarti
gsarti / calamita_2024_eureka_rebus_config.py
Created September 13, 2024 14:53
Configuration for 2-shot verbalized rebus solving for the CALAMITA 2024 campaign
# Huggingface Hub ID of the dataset. If data is not on HF, set the variable to 'other'
# NOTE: Default config is used
DATA_HUB_ID = "gsarti/eureka-rebus-calamita-2024"
# Task type. Values accepted: multiple_choice, open-ended
OUTPUT_TYPE = "open-ended"
### Prompting details
# Template string used to compile the prompt. Use {{}} variables to fill using the dataset columns.
@gsarti
gsarti / score_trainslation_qe_comet.py
Created January 6, 2022 13:21
Evaluate the translation of a 🤗 dataset using Comet-based QE models
import argparse
import os
from datasets import load_dataset
from comet import download_model, load_from_checkpoint
def replace_missing(scores, sentences, default = -100):
out = []
for score, sentence in zip(scores, sentences):
if not sentence:
out.append(default)
@gsarti
gsarti / run_marian_translate_flax.py
Last active January 6, 2022 13:17
Use 🤗 transformer FlaxMarianMTModel to translate 🤗 datasets text fields on TPU
import argparse
import datasets
import jax
from flax.jax_utils import replicate
from flax.training.common_utils import shard
from tqdm import tqdm
from transformers import FlaxMarianMTModel, MarianTokenizer
def translate(args):