hf_mirrors/pythia-intervention-70m-deduped
Model Introduction
Files & versions
Analysis

This model is part of an intervention study done in the paper Pythia: A Suite for Analyzing Large Language Models Across Training and Scaling where we replaced all masculine pronouns with femanine ones and retrained the model for the last 21 billion tokens. The regular model can be found here.

We do not recommend using this model for any purpose other than to study the influence of gender pronouns on language model behavior.

how to use

from openmind import pipeline
from openmind import is_torch_npu_available
import torch
import argparse
import torch.nn.functional as F
import time

def parse_args():
    parser = argparse.ArgumentParser()
    parser.add_argument(
        "--model_name_or_path",
        type=str,
        help="Path to model",
        default="zhouhui/pythia-intervention-70m-deduped",
    )
    args = parser.parse_args()
    return args

def main():
    args = parse_args()
    model_path = args.model_name_or_path

    if is_torch_npu_available():
        device = "npu:0"
    else:
        device = "cpu"   
    #device = "cpu"  
    start_time = time.time()
    generator = pipeline('text-generation', model= model_path , device=device,trust_remote_code=True)
    output = generator("Hello, who are you?", do_sample=True, min_length=50)
    print(f">>>output={output}")
    end_time = time.time()
    print(f"硬件环境:{device},推理执行时间:{end_time - start_time}秒")


if __name__ == "__main__":
    main()