Instructions to use berwart/Inteligent_ai with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use berwart/Inteligent_ai with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="berwart/Inteligent_ai")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("berwart/Inteligent_ai", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use berwart/Inteligent_ai with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "berwart/Inteligent_ai" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "berwart/Inteligent_ai", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/berwart/Inteligent_ai
- SGLang
How to use berwart/Inteligent_ai 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 "berwart/Inteligent_ai" \ --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": "berwart/Inteligent_ai", "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 "berwart/Inteligent_ai" \ --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": "berwart/Inteligent_ai", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use berwart/Inteligent_ai with Docker Model Runner:
docker model run hf.co/berwart/Inteligent_ai
Download model.safetensors from berwart/Inteligent_ai: direct link, hf CLI and curl.
- Browser
- Download file 1.61 kB
-
https://huggingface.co/berwart/Inteligent_ai/resolve/main/model.safetensors
- Command line
-
hf download hf://berwart/Inteligent_ai/model.safetensors
-
curl -L -o model.safetensors https://huggingface.co/berwart/Inteligent_ai/resolve/main/model.safetensors
1.61 kB
| import torch | |
| from transformers import PreTrainedModel, PreTrainedTokenizerFast, PretrainedConfig, CausalLMOutput | |
| # Define the model configuration | |
| class HelloWorldConfig(PretrainedConfig): | |
| model_type = "hello-world" | |
| vocab_size = 2 | |
| bos_token_id = 0 | |
| eos_token_id = 1 | |
| # Define the model | |
| class HelloWorldModel(PreTrainedModel): | |
| config_class = HelloWorldConfig | |
| def __init__(self, config): | |
| super().__init__(config) | |
| def forward(self, input_ids=None, **kwargs): | |
| batch_size = input_ids.shape[0] | |
| sequence_length = input_ids.shape[1] | |
| # Generate logits for the "Hello, world!" token | |
| hello_world_token_id = self.config.vocab_size - 1 | |
| logits = torch.full((batch_size, sequence_length, self.config.vocab_size), float('-inf')) | |
| logits[:, :, hello_world_token_id] = 0 | |
| return CausalLMOutput(logits=logits) | |
| # Define and save the tokenizer | |
| tokenizer = PreTrainedTokenizerFast(tokenizer_file="tokenizer.json") | |
| tokenizer.add_tokens(["Hello, world!"]) | |
| tokenizer_config = { | |
| "do_lower_case": False, | |
| "model_max_length": 512, | |
| "padding_side": "right", | |
| "special_tokens_map_file": None, | |
| "tokenizer_file": "tokenizer.json", | |
| "unk_token": "<unk>", | |
| "bos_token": "<s>", | |
| "eos_token": "</s>", | |
| "vocab_size": 2, | |
| } | |
| with open("tokenizer.json", "w") as f: | |
| json.dump(tokenizer_config, f) | |
| # Initialize model | |
| config = HelloWorldConfig() | |
| model = HelloWorldModel(config) | |
| # Save model using safetensors format | |
| from safetensors.torch import save_file | |
| save_file(model.state_dict(), "hello_world_model.safetensors") | |