semvec/pypi-packages huggingface dataset:
meta-llama-3-yarn 0.1.3
YaRN Implementation compatible with HuggingFace Transformers

# meta-llama-3-yarn


### Getting Started

#### Install with pip

```txt
pip install meta-llama-3-yarn
```

#### Build from source

You can also build and install meta-llama-3-yarn from source:

```txt
git clone https://github.com/MeetKai/meta-llama-3-yarn.git
cd meta-llama-3-yarn
pip install -e .
```


### Usage

To use a Llama-3 model regardless whether it is a YaRN-scaled model:

```python
import torch
from transformers import AutoTokenizer
from meta_llama_3_yarn import LlamaForCausalLM

model_name = "meta-llama/Meta-Llama-3-8B-Instruct"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = LlamaForCausalLM.from_pretrained(
    model_name, device_map="auto", torch_dtype=torch.bfloat16
)

messages = [
    {"role": "user", "content": "Write a piece of quicksort code in C++"}
]
input_tensor = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt")
outputs = model.generate(input_tensor.to(model.device), max_new_tokens=100)

result = tokenizer.decode(outputs[0][input_tensor.shape[1]:], skip_special_tokens=True)
print(result)
```

To specifically scale a model using YaRN:

```python
import torch
from transformers import AutoTokenizer
from meta_llama_3_yarn import LlamaForCausalLM, LlamaConfig

model_name = "meta-llama/Meta-Llama-3-8B-Instruct"
context_length = 32768
tokenizer = AutoTokenizer.from_pretrained(model_name)
config = LlamaConfig.from_pretrained(model_name)
config.rope_scaling = {"type": "yarn", "factor": context_length / config.max_position_embeddings}
model = LlamaForCausalLM.from_pretrained(
    model_name, config=config, device_map="auto", torch_dtype=torch.bfloat16
)

messages = [
    {"role": "user", "content": "Write a piece of quicksort code in C++"}
]
input_tensor = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt")
outputs = model.generate(input_tensor.to(model.device), max_new_tokens=100)

result = tokenizer.decode(outputs[0][input_tensor.shape[1]:], skip_special_tokens=True)
print(result)
```
netissuestools 0.0.2
To solve some network issues
Requires Python: >=3.6

# netissuestools

netissuestools 是一個網路工具,用於進行一些網路上的檢查。

## 功能

- import library --> import netissuestools
- 函式庫例子 --> netissuestools.Superfast_multithread_ping.main()
- 直接使用cmd指令 --> sfastping
- 原理是進行多線程的ping功能,65535個ip可以在約1分鐘內完成ping

## 安裝

可以使用 pip 安裝: pip install netissuestools

##例子

from netissuestools import Superfast_multithread_ping
Superfast_multithread_ping.main()