language: - he - en license: apache-2.0 library_name: transformers tags: - causal-lm - duchifat - pytorch-lightning - hebrew-llm - bilingual datasets: - allenai/c4 metrics: - perplexity

WhatsApp Image 2026-03-06 at 17.21.15

๐Ÿš€ Duchifat-V2 (ื“ื•ื›ื™ืคืช 2) | Official Model Card

๐Ÿ“ Executive Summary

Duchifat-V2 is a state-of-the-art 136M parameter causal language model (LLM) developed by TopAI. Architected from the ground up, Duchifat-V2 is specifically engineered to bridge the gap between Semitic linguistic structures and modern generative AI. By utilizing a custom-tailored tokenizer and a bilingual training strategy, the model achieves high-performance text generation in both Hebrew and English.


๐Ÿ—๏ธ Technical Specifications & Architecture

Duchifat-V2 implements a high-efficiency Decoder-only Transformer architecture with the following parameters:

Component Specification Description
Parameters 136 Million Optimized for high-speed inference and edge deployment.
Architecture Transformer-Decoder Causal modeling for generative tasks.
Layers 12 Depth optimized for complex syntactic reasoning.
Attention Heads 12 Multi-head self-attention for global context capture.
Hidden Size 768 Balanced representational capacity.
Context Window 1024 Tokens Sufficient for long-form document processing.
Activation GELU (Approximate) Modern non-linearity for smoother gradient flow.
Tokenizer DictaLM 2.0 Optimized for Hebrew morphology and sub-word efficiency.

๐Ÿ“Š Training Infrastructure & Dataset

1. Data Composition

The model underwent rigorous training on a curated version of the C4 (Colossal Clean Crawled Corpus), distributed as follows:

  • Hebrew (50%): High-quality web data, news, and academic sources.
  • English (50%): General knowledge base for cross-lingual transfer learning.

2. Compute & Framework

  • Compute: NVIDIA L4 / A100 Tensor Core GPUs.
  • Orchestration: PyTorch Lightning (v2.x).
  • Optimization: AdamW ($\beta_1=0.9, \beta_2=0.95$).
  • Precision: 16-bit Mixed Precision (O2) for memory efficiency.
  • Training Steps: ~50,000 Global Steps.
  • Effective Batch Size: 64 (via Gradient Accumulation).

๐ŸŽฏ Key Performance Indicators (KPIs)

  • Native Hebrew Fluency: Superior understanding of Hebrew grammar compared to general-purpose multilingual models of similar size.
  • Zero-Shot Potential: Demonstrated ability to handle basic logic and continuation tasks without fine-tuning.
  • Bilingual Versatility: Seamlessly handles code-switching and bilingual contexts.

๐Ÿ’ป Implementation & Inference

Model Loading

Since Duchifat-V2 uses a custom architecture, ensure the model class (DuchifatCore) is defined in your environment:

import torch
from transformers import AutoModelForCausalLM, AutoTokenizer

# --- ื”ื’ื“ืจื•ืช ---
model_id = "Raziel1234/Duchifat-2"
device = "cuda" if torch.cuda.is_available() else "cpu"

print(" ื˜ื•ืขืŸ ืืช Duchifat-2: ื”ื•ืคืš ืœืžื—ื•ืœืœ ื‘ืœื•ื’ื™ื ื™ืฆื™ืจืชื™...")

tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
base_model = AutoModelForCausalLM.from_pretrained(
    model_id, 
    trust_remote_code=True, 
    torch_dtype=torch.bfloat16
).to(device)

if not hasattr(base_model.config, "num_hidden_layers"):
    base_model.config.num_hidden_layers = 12

base_model.eval()

def generate_blog_post(topic_title, language="en"):
    """
    ืคื•ื ืงืฆื™ื” ืœื™ืฆื™ืจืช ืคื•ืกื˜ ืœื‘ืœื•ื’. 
    ื”ื™ื ื‘ื•ื ื” ืคืชื™ื— ืฉื’ื•ืจื ืœืžื•ื“ืœ ืœื”ื™ื›ื ืก ืœืžื•ื“ ืฉืœ ื›ืชื™ื‘ืช ืชื•ื›ืŸ.
    """
    if language == "he":
        prompt = f"ืคื•ืกื˜ ื—ื“ืฉ ื‘ื‘ืœื•ื’: {topic_title}\nื”ื™ื•ื ืื ื™ ืจื•ืฆื” ืœื“ื‘ืจ ืขืœ ื ื•ืฉื ืžืจืชืง ืฉืžืขืกื™ืง ืื•ืชื™ ืจื‘ื•ืช. "
    else:
        prompt = f"Blog Post: {topic_title}\nIn today's post, I want to share some unique insights about {topic_title}. This journey began when "

    inputs = tokenizer(prompt, return_tensors="pt").to(device)
    
    with torch.no_grad():
        outputs = base_model.generate(
            **inputs, 
            max_new_tokens=250,      # ืื•ืจืš ืฉืœ ืคื•ืกื˜ ืžื›ื•ื‘ื“
            do_sample=True,
            temperature=0.8,         # ื™ืฆื™ืจืชื™ื•ืช ื’ื‘ื•ื”ื” ืœื‘ืœื•ื’
            top_p=0.92,
            repetition_penalty=1.2,
            no_repeat_ngram_size=3,  # ืžื•ื ืข ื—ื–ืจืชื™ื•ืช ืžืขืฆื‘ื ืช
            eos_token_id=tokenizer.eos_token_id,
            pad_token_id=tokenizer.eos_token_id
        )
    
    return tokenizer.decode(outputs[0], skip_special_tokens=True)

# --- ื”ืจืฆืช ื‘ื“ื™ืงื”: ื™ืฆื™ืจืช ื‘ืœื•ื’ื™ื ---
print("\n" + "="*40)
print(" ื›ืชื™ื‘ืช ืคื•ืกื˜ื™ื ืœื‘ืœื•ื’ (Duchifat-2 Base):")
print("="*40)

# ื‘ื“ื™ืงื” 1: ื‘ืœื•ื’ ื˜ื›ื ื•ืœื•ื’ื™ ื‘ืื ื’ืœื™ืช
print(" Blog 1 (English - AI Tech):")
blog_en = generate_blog_post("The Future of AI in Daily Life")
print(blog_en)

print("-" * 30)

# ื‘ื“ื™ืงื” 2: ื‘ืœื•ื’ ืกื’ื ื•ืŸ ื—ื™ื™ื ื‘ืขื‘ืจื™ืช
print(" ื‘ืœื•ื’ 2 (ืขื‘ืจื™ืช - ืœื™ื™ืฃ ืกื˜ื™ื™ืœ):")
blog_he = generate_blog_post("ื”ื—ืฉื™ื‘ื•ืช ืฉืœ ื–ืžืŸ ืื™ื›ื•ืช ืขื ืขืฆืžืš", language="he")
print(blog_he)
import requests
import sys
import io

# ืชื™ืงื•ืŸ ืขื‘ืจื™ืช ืœื•ื•ื™ื ื“ื•ืก
if sys.platform == "win32":
    sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')

URL = "https://rnevo2016--duchifat-2-ultra-fast-streaming-fastapi-app.modal.run/v1/stream"

# ืžื›ื™ื•ื•ืŸ ืฉื–ื” ืžื•ื“ืœ BASE - ืชืŸ ืœื• ื”ืชื—ืœื” ืฉืœ ืžืฉืคื˜ (ื”ืฉืœืžื”)
payload = {
    "prompt": "There is something magical about waking up in a city youโ€™ve never visited before. This morning in Rome, the smell of fresh espresso and warm cornetti drifted through the open window of my small Airbnb. As I stepped out onto the cobblestone streets, I realized that the best way to see this city isn't by following a map, but by getting lost in its narrow alleys. My first stop was a tiny bakery where I discovered that",
    "temperature": 0.5,        # ื ืžื•ืš = ื™ื•ืชืจ ืžืžื•ืงื“, ื’ื‘ื•ื” = ื™ื•ืชืจ ื™ืฆื™ืจืชื™
    "repetition_penalty": 1.4, # ืขื•ื–ืจ ืœืžื ื•ืข ืœื•ืคื™ื ืฉืœ ืืชืจื™ ื—ื“ืฉื•ืช
    "max_new_tokens": 300
}

print("ื“ื•ื›ื™ืคืช ืžื–ืจื™ืžื” ื ืชื•ื ื™ื ื‘ื–ืžืŸ ืืžืช...\n")

try:
    with requests.post(URL, json=payload, stream=True) as r:
        r.raise_for_status()
        for line in r.iter_lines():
            if line:
                decoded = line.decode('utf-8')
                if decoded.startswith("data: "):
                    # ื—ื™ืœื•ืฅ ื”ื˜ื•ืงืŸ ื•ื”ื“ืคืกื” ืžื™ื™ื“ื™ืช
                    token = decoded.replace("data: ", "")
                    print(token, end="", flush=True)
except Exception as e:
    print(f"\nError: {e}")

print("\n" + "="*30)

Official App:

Go to: https://duchifat-2-474222140307.us-west1.run.app

Downloads last month
3,050
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for Raziel1234/Duchifat-2

Finetunes
6 models

Dataset used to train Raziel1234/Duchifat-2