Text Generation
Transformers
Safetensors
llama
memory-augmented
conversational
custom_code
text-generation-inference
Instructions to use botverse/Titans-MAC-Llama-3-8b-Instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use botverse/Titans-MAC-Llama-3-8b-Instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="botverse/Titans-MAC-Llama-3-8b-Instruct", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("botverse/Titans-MAC-Llama-3-8b-Instruct", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("botverse/Titans-MAC-Llama-3-8b-Instruct", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use botverse/Titans-MAC-Llama-3-8b-Instruct with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "botverse/Titans-MAC-Llama-3-8b-Instruct" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "botverse/Titans-MAC-Llama-3-8b-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/botverse/Titans-MAC-Llama-3-8b-Instruct
- SGLang
How to use botverse/Titans-MAC-Llama-3-8b-Instruct 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 "botverse/Titans-MAC-Llama-3-8b-Instruct" \ --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": "botverse/Titans-MAC-Llama-3-8b-Instruct", "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 "botverse/Titans-MAC-Llama-3-8b-Instruct" \ --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": "botverse/Titans-MAC-Llama-3-8b-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use botverse/Titans-MAC-Llama-3-8b-Instruct with Docker Model Runner:
docker model run hf.co/botverse/Titans-MAC-Llama-3-8b-Instruct
Error when loading
#1
by irodkin - opened
Code:
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch # Added import for example
model_id = "botverse/Titans-MAC-Llama-3-8b-Instruct" # Replace with your repo ID
# Load the model and tokenizer, allowing custom code execution
# Requires sufficient VRAM for the Llama 8B model + memory buffer
model = AutoModelForCausalLM.from_pretrained(
model_id,
trust_remote_code=True,
torch_dtype=torch.float16, # Recommended for memory
device_map="auto"
)
Error:
ValueError Traceback (most recent call last)
Cell In[1], line 8
4 model_id = "botverse/Titans-MAC-Llama-3-8b-Instruct" # Replace with your repo ID
6 # Load the model and tokenizer, allowing custom code execution
7 # Requires sufficient VRAM for the Llama 8B model + memory buffer
----> 8 model = AutoModelForCausalLM.from_pretrained(
9 model_id,
10 trust_remote_code=True,
11 torch_dtype=torch.float16, # Recommended for memory
12 device_map="auto"
13 )
14 tokenizer = AutoTokenizer.from_pretrained(model_id)
16 # Example prompt
File /opt/homebrew/Caskroom/miniconda/base/envs/ai/lib/python3.10/site-packages/transformers/models/auto/auto_factory.py:356, in _BaseAutoModelClass.from_pretrained(cls, pretrained_model_name_or_path, *model_args, **kwargs)
353 kwargs["adapter_kwargs"] = adapter_kwargs
355 if has_remote_code and trust_remote_code:
--> 356 model_class = get_class_from_dynamic_module(
357 class_ref, pretrained_model_name_or_path, code_revision=code_revision, **hub_kwargs, **kwargs
358 )
359 _ = hub_kwargs.pop("code_revision", None)
360 # This block handles the case where the user is loading a model with `trust_remote_code=True`
361 # but a library model exists with the same name. We don't want to override the autoclass
362 # mappings in this case, or all future loads of that model will be the remote code model.
File /opt/homebrew/Caskroom/miniconda/base/envs/ai/lib/python3.10/site-packages/transformers/dynamic_module_utils.py:567, in get_class_from_dynamic_module(class_reference, pretrained_model_name_or_path, cache_dir, force_download, proxies, token, revision, local_files_only, repo_type, code_revision, **kwargs)
565 else:
566 repo_id = pretrained_model_name_or_path
--> 567 module_file, class_name = class_reference.split(".")
569 if code_revision is None and pretrained_model_name_or_path == repo_id:
570 code_revision = revision
ValueError: too many values to unpack (expected 2)