Run this model with HF Jobs

Run Norod78/Hebrew-GPT2-345M-Stage 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 and TRL to fine-tune https://huggingface.co/Norod78/Hebrew-GPT2-345M-Stage. 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/Norod78/Hebrew-GPT2-345M-Stage 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.

Evaluate on a benchmark

Use HF Jobs to evaluate https://huggingface.co/Norod78/Hebrew-GPT2-345M-Stage. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.

Quantize for lower memory use

Use HF Jobs to create a 4-bit version of https://huggingface.co/Norod78/Hebrew-GPT2-345M-Stage. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.

Hebrew-GPT2-345M-Stage

An undertrained GPT2 based Hebrew text generation model which I slightly trained at 2020 on text from "Bama Hadasha" ("במה חדשה") A gguf version is available here

Dataset

Around 10% of the text from stage.co.il

LM Studio

A configuration scheme for LM Studio is available here

Usage with Transformers - sample code

import os
os.environ["PYTORCH_ENABLE_MPS_FALLBACK"] = "1"

from transformers import pipeline, set_seed
import random

model_id = "Norod78/Hebrew-GPT2-345M-Stage"
text_generator = pipeline('text-generation', model=model_id, tokenizer=model_id, device_map="auto")
max_length = 256
top_k = 70
top_p = 0.92
temperature = 1.0
max_seed = (2**32)-1
global_seed = random.randint(0, max_seed)

def text_generation(input_text = ''):
    global global_seed
    global_seed = global_seed + 1
    if global_seed >= max_seed:
        global_seed = 0
    if input_text == None or len(input_text) == 0:
        input_text = "\n"
    set_seed(global_seed)
    generated_text = text_generator(input_text,
    max_length=max_length,
    top_k=top_k, 
    top_p=top_p,    
    temperature=temperature,
    do_sample=True,
    repetition_penalty=1.4,
    num_return_sequences=1)
    parsed_text = generated_text[0]["generated_text"].replace("<|startoftext|>", "").replace("\r","").replace("\n\n", "\n").replace("\t", " ").replace("<|pad|>", " * ").replace("\"\"", "\"").strip()
    #print("parsed_text = \"" + parsed_text + "\" (seed = " + str(global_seed) + ")")
    return parsed_text

def main():
    prompt_prefix = "\n\n שם היצירה: "
    prompt_text = prompt_prefix + "חגבים ירוקים מקפצים בשדה"
    result = text_generation(input_text=prompt_text)
    print("result : \n" + str(result))

if __name__ == '__main__':
    main()
Downloads last month
862
Safetensors
Model size
0.4B params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Space using Norod78/Hebrew-GPT2-345M-Stage 1