Text Generation
Transformers
Safetensors
Pruna AI
llama
pruna_pro-ai
conversational
text-generation-inference
4-bit precision
higgs
Instructions to use pruna-test/tiny_llama_higgs with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use pruna-test/tiny_llama_higgs with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="pruna-test/tiny_llama_higgs") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("pruna-test/tiny_llama_higgs") model = AutoModelForCausalLM.from_pretrained("pruna-test/tiny_llama_higgs", device_map="auto") 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=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Pruna AI
How to use pruna-test/tiny_llama_higgs with Pruna AI:
# Use a pipeline as a high-level helper from pruna_pro import PrunaProModel pipe = PrunaProModel.from_pretrained("pruna-test/tiny_llama_higgs") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)from pruna_pro import PrunaProModel # pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer tokenizer = AutoTokenizer.from_pretrained("pruna-test/tiny_llama_higgs") model = PrunaProModel.from_pretrained("pruna-test/tiny_llama_higgs", device_map="auto") 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=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use pruna-test/tiny_llama_higgs with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "pruna-test/tiny_llama_higgs" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "pruna-test/tiny_llama_higgs", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/pruna-test/tiny_llama_higgs
- SGLang
How to use pruna-test/tiny_llama_higgs 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 "pruna-test/tiny_llama_higgs" \ --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": "pruna-test/tiny_llama_higgs", "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 "pruna-test/tiny_llama_higgs" \ --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": "pruna-test/tiny_llama_higgs", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use pruna-test/tiny_llama_higgs with Docker Model Runner:
docker model run hf.co/pruna-test/tiny_llama_higgs
|
Download README.md from pruna-test/tiny_llama_higgs: direct link, hf CLI and curl.
- Browser
- Download file 2.78 kB
-
https://huggingface.co/pruna-test/tiny_llama_higgs/resolve/main/README.md
- Command line
-
hf download hf://pruna-test/tiny_llama_higgs/README.md
-
curl -L -o README.md https://huggingface.co/pruna-test/tiny_llama_higgs/resolve/main/README.md
2.78 kB
| library_name: transformers | |
| tags: | |
| - safetensors | |
| - pruna_pro-ai | |
| - pruna-ai | |
| # Model Card for loulou2/tiny_llama_higgs | |
| This model was created using the [pruna](https://github.com/PrunaAI/pruna) library. Pruna is a model optimization framework built for developers, enabling you to deliver more efficient models with minimal implementation overhead. | |
| ## Usage | |
| First things first, you need to install the pruna library: | |
| ```bash | |
| pip install pruna_pro | |
| ``` | |
| You can [use the transformers library to load the model](https://huggingface.co/loulou2/tiny_llama_higgs?library=transformers) but this might not include all optimizations by default. | |
| To ensure that all optimizations are applied, use the pruna library to load the model using the following code: | |
| ```python | |
| from pruna_pro import PrunaProModel | |
| loaded_model = PrunaProModel.from_pretrained( | |
| "loulou2/tiny_llama_higgs" | |
| ) | |
| # we can then run inference using the methods supported by the base model | |
| ``` | |
| Alternatively, you can visit [the Pruna documentation](https://docs.pruna.ai/en/stable/) for more information. | |
| ## Smash Configuration | |
| The compression configuration of the model is stored in the `smash_config.json` file, which describes the optimization methods that were applied to the model. | |
| ```bash | |
| { | |
| "batcher": null, | |
| "cacher": null, | |
| "compiler": null, | |
| "distiller": null, | |
| "distributer": null, | |
| "enhancer": null, | |
| "factorizer": null, | |
| "kernel": null, | |
| "pruner": null, | |
| "quantizer": "higgs", | |
| "recoverer": null, | |
| "higgs_group_size": 256, | |
| "higgs_hadamard_size": 1024, | |
| "higgs_p": 2, | |
| "higgs_weight_bits": 4, | |
| "batch_size": 1, | |
| "device": "cuda", | |
| "device_map": null, | |
| "save_fns": [ | |
| "transformers_higgs" | |
| ], | |
| "load_fns": [ | |
| "transformers_higgs" | |
| ], | |
| "reapply_after_load": { | |
| "factorizer": null, | |
| "pruner": null, | |
| "quantizer": null, | |
| "distiller": null, | |
| "kernel": null, | |
| "cacher": null, | |
| "recoverer": null, | |
| "distributer": null, | |
| "compiler": null, | |
| "batcher": null, | |
| "enhancer": null | |
| } | |
| } | |
| ``` | |
| ## 🌍 Join the Pruna AI community! | |
| [](https://twitter.com/PrunaAI) | |
| [](https://github.com/PrunaAI) | |
| [](https://www.linkedin.com/company/93832878/admin/feed/posts/?feedType=following) | |
| [](https://discord.gg/JFQmtFKCjd) | |
| [](https://www.reddit.com/r/PrunaAI/) |