Text Generation
Transformers
Safetensors
PyTorch
Indonesian
English
caca
causal-lm
transformer
untrained
gqa
rope
swiglu
rmsnorm
flash-attention
indonesian
bilingual
custom_code
Instructions to use Lyon28/caca-30M-untrained with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Lyon28/caca-30M-untrained with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Lyon28/caca-30M-untrained", trust_remote_code=True)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("Lyon28/caca-30M-untrained", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Lyon28/caca-30M-untrained with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Lyon28/caca-30M-untrained" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Lyon28/caca-30M-untrained", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Lyon28/caca-30M-untrained
- SGLang
How to use Lyon28/caca-30M-untrained 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 "Lyon28/caca-30M-untrained" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Lyon28/caca-30M-untrained", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "Lyon28/caca-30M-untrained" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Lyon28/caca-30M-untrained", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Lyon28/caca-30M-untrained with Docker Model Runner:
docker model run hf.co/Lyon28/caca-30M-untrained
Fix: add missing import torch
Browse files- caca_transformers.py +10 -5
caca_transformers.py
CHANGED
|
@@ -1,16 +1,21 @@
|
|
| 1 |
# --- Import Libraries ---
|
|
|
|
| 2 |
import torch
|
| 3 |
import torch.nn as nn
|
| 4 |
import torch.nn.functional as F
|
| 5 |
-
import
|
| 6 |
-
import os
|
| 7 |
-
import json
|
| 8 |
-
import logging
|
| 9 |
from transformers import PretrainedConfig, PreTrainedModel
|
| 10 |
from transformers.modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast
|
| 11 |
from transformers.generation.utils import GenerationMixin
|
| 12 |
-
from
|
| 13 |
from collections import OrderedDict, defaultdict
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
logger = logging.getLogger(__name__)
|
| 16 |
|
|
|
|
| 1 |
# --- Import Libraries ---
|
| 2 |
+
from __future__ import annotations
|
| 3 |
import torch
|
| 4 |
import torch.nn as nn
|
| 5 |
import torch.nn.functional as F
|
| 6 |
+
import numpy as np
|
|
|
|
|
|
|
|
|
|
| 7 |
from transformers import PretrainedConfig, PreTrainedModel
|
| 8 |
from transformers.modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast
|
| 9 |
from transformers.generation.utils import GenerationMixin
|
| 10 |
+
from safetensors.torch import save_file
|
| 11 |
from collections import OrderedDict, defaultdict
|
| 12 |
+
from typing import Any, Dict, List, Optional, Tuple, Union
|
| 13 |
+
import tempfile
|
| 14 |
+
import math
|
| 15 |
+
import os
|
| 16 |
+
import json
|
| 17 |
+
import logging
|
| 18 |
+
import warnings
|
| 19 |
|
| 20 |
logger = logging.getLogger(__name__)
|
| 21 |
|