Text Generation
Transformers
Turkish
erk_linear
linear-attention
gated-deltanet
hybrid-attention
efficient-attention
turkish
erk
research
custom_code
conversational
Eval Results (legacy)
Run this model with HF Jobs
Run ecloudtech/Erk-Linear 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/ecloudtech/Erk-Linear. Ask me which dataset to train on, then push the LoRA adapter to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs and Transformers to run batch inference with https://huggingface.co/ecloudtech/Erk-Linear on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the predictions back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs and Lighteval to evaluate https://huggingface.co/ecloudtech/Erk-Linear. 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/ecloudtech/Erk-Linear with Transformers and bitsandbytes. 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.
Instructions to use ecloudtech/Erk-Linear with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ecloudtech/Erk-Linear with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ecloudtech/Erk-Linear", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("ecloudtech/Erk-Linear", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use ecloudtech/Erk-Linear with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ecloudtech/Erk-Linear" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ecloudtech/Erk-Linear", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/ecloudtech/Erk-Linear
- SGLang
How to use ecloudtech/Erk-Linear with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "ecloudtech/Erk-Linear" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ecloudtech/Erk-Linear", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "ecloudtech/Erk-Linear" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ecloudtech/Erk-Linear", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use ecloudtech/Erk-Linear with Docker Model Runner:
docker model run hf.co/ecloudtech/Erk-Linear
Standart yukleme: auto_map + ErkLinearForCausalLM
Browse files12345678910114567891011121314151617151819202122232425262728295 unmodified lines3536373839404121 unmodified lines6364656667686916 unmodified lines868788798081828990919284939486878889909192959697989910010110210310494105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176"""Erk-Linear — Erk-14B'nin 8 dikkat katmanini Gated DeltaNet'e damitan %20-lineer hibrit.
Yukleme: # gerekli: pip install torch transformers flash-linear-attention safetensors huggingface_hub from modeling_erk_linear import load_erk_linear model, tokenizer = load_erk_linear() # Erk-14B tabanini + GDN agirliklarini indirir out = model.generate(**tokenizer("Merhaba", return_tensors="pt").to(model.device))
Model, Qwen3-14B mimarisine dayanir; 8 katmanin softmax dikkati subquadratic Gated DeltaNet iledegistirilmis, kalan 32 katman softmax "cipa" olarak korunmustur. Ayrinti: teknik rapor / GitHub.Yukleme (standart yol): from transformers import AutoModelForCausalLM, AutoTokenizer model = AutoModelForCausalLM.from_pretrained("ecloudtech/Erk-Linear", trust_remote_code=True) tok = AutoTokenizer.from_pretrained("ecloudtech/Erk-Linear")
Gereksinimler: torch, transformers, flash-linear-attention, safetensors, huggingface_hub
Model Qwen3-14B mimarisine dayanir; 8 katmanin softmax dikkati subquadratic Gated DeltaNetile degistirilmis, kalan 32 katman softmax "cipa" olarak korunmustur. Govde agirliklari`config.base_model` deposundan, GDN agirliklari bu depodan yuklenir; from_pretrainedikisini birlestirip calisir bir nedensel dil modeli doner."""import torchimport torch.nn as nnfrom transformers import AutoModelForCausalLM, AutoTokenizerfrom transformers import AutoModelForCausalLM, AutoTokenizer, PreTrainedModelfrom safetensors.torch import load_filefrom huggingface_hub import hf_hub_download
try: # HF uzak kod (paket icinde) from .configuration_erk_linear import ErkLinearConfigexcept ImportError: # yerel kullanim (dosya yan yana) from configuration_erk_linear import ErkLinearConfig
BASE_MODEL = "ecloudtech/Erk-14B" # Qwen3-14B temelli Turkce modelREPO_ID = "ecloudtech/Erk-Linear"GDN_LAYERS = [1, 3, 5, 7, 10, 36, 38, 39] # %20 lineer, yayilmis yerlesim5 unmodified lines FLA'nin recurrent_state + conv_state'ini tek katman icin saklar; boylece cache'li uretim sirasinda GDN gecmis durumu adimlar arasi devreder. """
def __init__(self): self._layers = []
21 unmodified lines (use_cache=False) ile sayisal gurultuye kadar ayni olur. Referans amacli tek-dizi kullanim icindir (es zamanli/batch-paylasimli servis icin ayri durum yonetimi gerekir). """
def __init__(self, gdn): super().__init__() gdn.layer_idx = 016 unmodified lines return (y, None)
def load_erk_linear(device="cuda", dtype=torch.bfloat16, base_model=BASE_MODEL, repo_id=REPO_ID): """Erk-Linear hibridini kurar ve (model, tokenizer) doner.""" from fla.layers import GatedDeltaNet # flash-linear-attentiondef _install_gdn(model, gdn_state, cfg, device, dtype): """Govde modelin secili self_attn katmanlarini GDN sarmalayicilariyla degistirir.""" from fla.layers import GatedDeltaNet # flash-linear-attention (triton -> GPU gerekir)
model = AutoModelForCausalLM.from_pretrained(base_model, torch_dtype=dtype).to(device).eval() layers = getattr(cfg, "gdn_layers", GDN_LAYERS) H = model.config.hidden_size
gdn_path = hf_hub_download(repo_id=repo_id, filename="gdn_weights.safetensors") state = load_file(gdn_path)
for li in GDN_LAYERS: gdn = GatedDeltaNet(hidden_size=H, head_dim=128, num_heads=40, use_gate=True, use_short_conv=True, mode="chunk") for li in layers: gdn = GatedDeltaNet( hidden_size=H, head_dim=getattr(cfg, "gdn_head_dim", 128), num_heads=getattr(cfg, "gdn_num_heads", 40), use_gate=getattr(cfg, "gdn_use_gate", True), use_short_conv=getattr(cfg, "gdn_use_short_conv", True), mode=getattr(cfg, "gdn_mode", "chunk"), ) prefix = f"L{li}." layer_sd = {k[len(prefix):]: v for k, v in state.items() if k.startswith(prefix)} layer_sd = {k[len(prefix):]: v for k, v in gdn_state.items() if k.startswith(prefix)} if not layer_sd: raise ValueError(f"L{li} icin GDN agirligi bulunamadi ({cfg.gdn_weights_file})") gdn.load_state_dict(layer_sd) gdn = gdn.to(device).to(dtype).eval() model.model.layers[li].self_attn = _GDNAttention(gdn).to(device).to(dtype) return model
class ErkLinearForCausalLM(PreTrainedModel): """%20-lineer Erk hibridi.
`from_pretrained`, govdeyi `config.base_model` deposundan yukler, bu depodaki GDN agirliklarini secili katmanlara takar ve elde edilen **calisir nedensel dil modelini** doner. Donen nesne standart bir transformers modelidir: `.generate()`, `.forward()`, `use_cache` ve chat sablonu oldugu gibi calisir. """
config_class = ErkLinearConfig base_model_prefix = "erk_linear"
@classmethod def from_pretrained(cls, pretrained_model_name_or_path=None, *model_args, **kwargs): repo = pretrained_model_name_or_path or REPO_ID cfg = kwargs.pop("config", None) if not isinstance(cfg, ErkLinearConfig): cfg = ErkLinearConfig.from_pretrained(repo, **{ k: kwargs[k] for k in ("revision", "token", "cache_dir") if k in kwargs })
dtype = kwargs.pop("dtype", None) or kwargs.pop("torch_dtype", None) or torch.bfloat16 device_map = kwargs.pop("device_map", None) kwargs.pop("trust_remote_code", None)
base_kwargs = dict(kwargs) if device_map is not None: base_kwargs["device_map"] = device_map model = AutoModelForCausalLM.from_pretrained( cfg.base_model, dtype=dtype, trust_remote_code=True, **base_kwargs ) if device_map is None: model = model.to("cuda" if torch.cuda.is_available() else "cpu") model.eval()
gdn_path = hf_hub_download( repo_id=repo, filename=getattr(cfg, "gdn_weights_file", "gdn_weights.safetensors"), **{k: kwargs[k] for k in ("revision", "token", "cache_dir") if k in kwargs}, ) gdn_state = load_file(gdn_path)
device = next(model.parameters()).device model = _install_gdn(model, gdn_state, cfg, device, dtype) model.config.erk_linear = { "gdn_layers": cfg.gdn_layers, "linear_ratio": cfg.linear_ratio, "base_model": cfg.base_model, } return model
def load_erk_linear(device="cuda", dtype=torch.bfloat16, base_model=BASE_MODEL, repo_id=REPO_ID): """Geriye donuk uyumlu yardimci: (model, tokenizer) doner.""" cfg = ErkLinearConfig(base_model=base_model) model = AutoModelForCausalLM.from_pretrained(base_model, dtype=dtype, trust_remote_code=True).to(device).eval() gdn_path = hf_hub_download(repo_id=repo_id, filename=cfg.gdn_weights_file) model = _install_gdn(model, load_file(gdn_path), cfg, device, dtype) tokenizer = AutoTokenizer.from_pretrained(base_model) return model, tokenizer
modeling_erk_linear.py+97-22