Text Generation
Transformers
Safetensors
Italian
English
quark
causal-lm
bilingual
italian
english
small-language-model
trained-from-scratch
conversational
custom_code
Instructions to use ThingAI/ARK-270M-Base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ThingAI/ARK-270M-Base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ThingAI/ARK-270M-Base", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("ThingAI/ARK-270M-Base", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use ThingAI/ARK-270M-Base with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ThingAI/ARK-270M-Base" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ThingAI/ARK-270M-Base", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/ThingAI/ARK-270M-Base
- SGLang
How to use ThingAI/ARK-270M-Base 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 "ThingAI/ARK-270M-Base" \ --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": "ThingAI/ARK-270M-Base", "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 "ThingAI/ARK-270M-Base" \ --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": "ThingAI/ARK-270M-Base", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use ThingAI/ARK-270M-Base with Docker Model Runner:
docker model run hf.co/ThingAI/ARK-270M-Base
Upload modeling_quark.py with huggingface_hub
Browse files- modeling_quark.py +1 -0
modeling_quark.py
CHANGED
|
@@ -76,6 +76,7 @@ class QuarkForCausalLM(QuarkPreTrainedModel):
|
|
| 76 |
self.lm_head=nn.Linear(config.d_model,config.vocab_size,bias=False)
|
| 77 |
self.lm_head.weight=self.embed_tokens.weight
|
| 78 |
self.post_init()
|
|
|
|
| 79 |
def get_input_embeddings(self): return self.embed_tokens
|
| 80 |
def set_input_embeddings(self, v): self.embed_tokens=v
|
| 81 |
def get_output_embeddings(self): return self.lm_head
|
|
|
|
| 76 |
self.lm_head=nn.Linear(config.d_model,config.vocab_size,bias=False)
|
| 77 |
self.lm_head.weight=self.embed_tokens.weight
|
| 78 |
self.post_init()
|
| 79 |
+
self.lm_head.weight = self.model.embed_tokens.weight
|
| 80 |
def get_input_embeddings(self): return self.embed_tokens
|
| 81 |
def set_input_embeddings(self, v): self.embed_tokens=v
|
| 82 |
def get_output_embeddings(self): return self.lm_head
|