maddes8cht commited on
Commit
aa52c54
1 Parent(s): cb9b0d9

"Update README.md"

Browse files
Files changed (1) hide show
  1. README.md +142 -0
README.md ADDED
@@ -0,0 +1,142 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ language: fr
4
+ pipeline_tag: text-generation
5
+ inference:
6
+ parameters:
7
+ temperature: 0.7
8
+ tags:
9
+ - LLM
10
+ - finetuned
11
+ ---
12
+ [![banner](https://maddes8cht.github.io/assets/buttons/Huggingface-banner.jpg)]()
13
+
14
+ I'm constantly enhancing these model descriptions to provide you with the most relevant and comprehensive information
15
+
16
+ # vigogne-stablelm-3b-4e1t-chat - GGUF
17
+ - Model creator: [bofenghuang](https://huggingface.co/bofenghuang)
18
+ - Original model: [vigogne-stablelm-3b-4e1t-chat](https://huggingface.co/bofenghuang/vigogne-stablelm-3b-4e1t-chat)
19
+
20
+ # StableLM
21
+ This is a Model based on StableLM.
22
+ Stablelm is a familiy of Language Models by Stability AI.
23
+
24
+ ## Note:
25
+ Current (as of 2023-11-15) implementations of Llama.cpp only support GPU offloading up to 34 Layers with these StableLM Models.
26
+ The model will crash immediately if -ngl is larger than 34.
27
+ The model works fine however without any gpu acceleration.
28
+
29
+
30
+
31
+ # About GGUF format
32
+
33
+ `gguf` is the current file format used by the [`ggml`](https://github.com/ggerganov/ggml) library.
34
+ A growing list of Software is using it and can therefore use this model.
35
+ The core project making use of the ggml library is the [llama.cpp](https://github.com/ggerganov/llama.cpp) project by Georgi Gerganov
36
+
37
+ # Quantization variants
38
+
39
+ There is a bunch of quantized files available to cater to your specific needs. Here's how to choose the best option for you:
40
+
41
+ # Legacy quants
42
+
43
+ Q4_0, Q4_1, Q5_0, Q5_1 and Q8 are `legacy` quantization types.
44
+ Nevertheless, they are fully supported, as there are several circumstances that cause certain model not to be compatible with the modern K-quants.
45
+ ## Note:
46
+ Now there's a new option to use K-quants even for previously 'incompatible' models, although this involves some fallback solution that makes them not *real* K-quants. More details can be found in affected model descriptions.
47
+ (This mainly refers to Falcon 7b and Starcoder models)
48
+
49
+ # K-quants
50
+
51
+ K-quants are designed with the idea that different levels of quantization in specific parts of the model can optimize performance, file size, and memory load.
52
+ So, if possible, use K-quants.
53
+ With a Q6_K, you'll likely find it challenging to discern a quality difference from the original model - ask your model two times the same question and you may encounter bigger quality differences.
54
+
55
+
56
+
57
+
58
+ ---
59
+
60
+ # Original Model Card:
61
+ # Vigogne-Stablelm-3B-4E1T-Chat
62
+
63
+ An attempt to fine-tune the [stablelm-3b-4e1t](https://huggingface.co/stabilityai/stablelm-3b-4e1t) model to explore the feasibility of adapting a "smaller-scale" language model, primarily pretrained on English datasets, for French chat.
64
+
65
+ **License**: A significant portion of the training data is distilled from GPT-3.5-Turbo and GPT-4, kindly use it cautiously to avoid any violations of OpenAI's [terms of use](https://openai.com/policies/terms-of-use).
66
+
67
+ ## Usage
68
+
69
+ ```python
70
+ from typing import Dict, List, Optional
71
+ import torch
72
+ from transformers import AutoModelForCausalLM, AutoTokenizer, GenerationConfig, TextStreamer
73
+
74
+ model_name_or_path = "bofenghuang/vigogne-stablelm-3b-4e1t-chat"
75
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, padding_side="right", use_fast=False)
76
+ model = AutoModelForCausalLM.from_pretrained(model_name_or_path, torch_dtype=torch.float16, device_map="auto", trust_remote_code=True)
77
+
78
+ streamer = TextStreamer(tokenizer, timeout=10.0, skip_prompt=True, skip_special_tokens=True)
79
+
80
+
81
+ def chat(
82
+ query: str,
83
+ history: Optional[List[Dict]] = None,
84
+ temperature: float = 0.7,
85
+ top_p: float = 1.0,
86
+ top_k: float = 0,
87
+ repetition_penalty: float = 1.1,
88
+ max_new_tokens: int = 1024,
89
+ **kwargs,
90
+ ):
91
+ if history is None:
92
+ history = []
93
+
94
+ history.append({"role": "user", "content": query})
95
+
96
+ input_ids = tokenizer.apply_chat_template(history, return_tensors="pt").to(model.device)
97
+ input_length = input_ids.shape[1]
98
+
99
+ generated_outputs = model.generate(
100
+ input_ids=input_ids,
101
+ generation_config=GenerationConfig(
102
+ temperature=temperature,
103
+ do_sample=temperature > 0.0,
104
+ top_p=top_p,
105
+ top_k=top_k,
106
+ repetition_penalty=repetition_penalty,
107
+ max_new_tokens=max_new_tokens,
108
+ pad_token_id=tokenizer.eos_token_id,
109
+ **kwargs,
110
+ ),
111
+ streamer=streamer,
112
+ return_dict_in_generate=True,
113
+ )
114
+
115
+ generated_tokens = generated_outputs.sequences[0, input_length:]
116
+ generated_text = tokenizer.decode(generated_tokens, skip_special_tokens=True)
117
+
118
+ history.append({"role": "assistant", "content": generated_text})
119
+
120
+ return generated_text, history
121
+
122
+
123
+ # 1st round
124
+ response, history = chat("Un escargot parcourt 100 mètres en 5 heures. Quelle est sa vitesse ?", history=None)
125
+ ```
126
+
127
+ ***End of original Model File***
128
+ ---
129
+
130
+
131
+ ## Please consider to support my work
132
+ **Coming Soon:** I'm in the process of launching a sponsorship/crowdfunding campaign for my work. I'm evaluating Kickstarter, Patreon, or the new GitHub Sponsors platform, and I am hoping for some support and contribution to the continued availability of these kind of models. Your support will enable me to provide even more valuable resources and maintain the models you rely on. Your patience and ongoing support are greatly appreciated as I work to make this page an even more valuable resource for the community.
133
+
134
+ <center>
135
+
136
+ [![GitHub](https://maddes8cht.github.io/assets/buttons/github-io-button.png)](https://maddes8cht.github.io)
137
+ [![Stack Exchange](https://stackexchange.com/users/flair/26485911.png)](https://stackexchange.com/users/26485911)
138
+ [![GitHub](https://maddes8cht.github.io/assets/buttons/github-button.png)](https://github.com/maddes8cht)
139
+ [![HuggingFace](https://maddes8cht.github.io/assets/buttons/huggingface-button.png)](https://huggingface.co/maddes8cht)
140
+ [![Twitter](https://maddes8cht.github.io/assets/buttons/twitter-button.png)](https://twitter.com/maddes1966)
141
+
142
+ </center>