Text Generation
Transformers
Safetensors
llama
llama-3
facebook
meta
astronomer
pretrained
finetuned
text-generation-inference
Instructions to use astronomer/Llama-3-8B-Special-Tokens-Adjusted with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use astronomer/Llama-3-8B-Special-Tokens-Adjusted with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="astronomer/Llama-3-8B-Special-Tokens-Adjusted")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("astronomer/Llama-3-8B-Special-Tokens-Adjusted") model = AutoModelForCausalLM.from_pretrained("astronomer/Llama-3-8B-Special-Tokens-Adjusted", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use astronomer/Llama-3-8B-Special-Tokens-Adjusted with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "astronomer/Llama-3-8B-Special-Tokens-Adjusted" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "astronomer/Llama-3-8B-Special-Tokens-Adjusted", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/astronomer/Llama-3-8B-Special-Tokens-Adjusted
- SGLang
How to use astronomer/Llama-3-8B-Special-Tokens-Adjusted 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 "astronomer/Llama-3-8B-Special-Tokens-Adjusted" \ --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": "astronomer/Llama-3-8B-Special-Tokens-Adjusted", "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 "astronomer/Llama-3-8B-Special-Tokens-Adjusted" \ --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": "astronomer/Llama-3-8B-Special-Tokens-Adjusted", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use astronomer/Llama-3-8B-Special-Tokens-Adjusted with Docker Model Runner:
docker model run hf.co/astronomer/Llama-3-8B-Special-Tokens-Adjusted
Update README.md
Browse files
README.md
CHANGED
|
@@ -52,7 +52,7 @@ The primary goal of releasing a patched version of this model was to address thi
|
|
| 52 |
|
| 53 |
## Details of the Adjustment
|
| 54 |
|
| 55 |
-
The [meta-llama/Meta-Llama-3-8B](https://huggingface.co/meta-llama/Meta-Llama-3-8B) model was pulled directly from HuggingFace and loaded using transformers. Then, the input embedding and output embedding
|
| 56 |
|
| 57 |
The special (untrained & problematic) tokens can be found by locating the rows where the entire row of the embedding values are all zeros, which imply they were not trained during the pretraining phase of the model from Meta. Such untrained tokens could lead to heavy computational issues, like gradient explosions or `NaN` gradients, during downstream fine-tuning on specific tasks.
|
| 58 |
|
|
|
|
| 52 |
|
| 53 |
## Details of the Adjustment
|
| 54 |
|
| 55 |
+
The [meta-llama/Meta-Llama-3-8B](https://huggingface.co/meta-llama/Meta-Llama-3-8B) model was pulled directly from HuggingFace and loaded using transformers. Then, the input embedding and output embedding values are retrieved using `model.get_input_embeddings().weight.data` and `model.get_output_embeddings().weight.data`. These 2 matrics are identical in shape, with each row representing a token id, and each column representing an embedding feature.
|
| 56 |
|
| 57 |
The special (untrained & problematic) tokens can be found by locating the rows where the entire row of the embedding values are all zeros, which imply they were not trained during the pretraining phase of the model from Meta. Such untrained tokens could lead to heavy computational issues, like gradient explosions or `NaN` gradients, during downstream fine-tuning on specific tasks.
|
| 58 |
|