correct Readme GPU example and API docstring (#9225)
* update readme to correct GPU usage * update from_pretrained supported low bit options * fix stype check
This commit is contained in:
		
							parent
							
								
									f87f67ee1c
								
							
						
					
					
						commit
						5850241423
					
				
					 2 changed files with 6 additions and 4 deletions
				
			
		| 
						 | 
					@ -127,6 +127,7 @@ You may apply INT4 optimizations to any Hugging Face *Transformers* model on Int
 | 
				
			||||||
```python
 | 
					```python
 | 
				
			||||||
#load Hugging Face Transformers model with INT4 optimizations
 | 
					#load Hugging Face Transformers model with INT4 optimizations
 | 
				
			||||||
from bigdl.llm.transformers import AutoModelForCausalLM
 | 
					from bigdl.llm.transformers import AutoModelForCausalLM
 | 
				
			||||||
 | 
					import intel_extension_for_pytorch
 | 
				
			||||||
model = AutoModelForCausalLM.from_pretrained('/path/to/model/', load_in_4bit=True)
 | 
					model = AutoModelForCausalLM.from_pretrained('/path/to/model/', load_in_4bit=True)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#run the optimized model on Intel GPU
 | 
					#run the optimized model on Intel GPU
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -60,9 +60,9 @@ class _BaseAutoModelClass:
 | 
				
			||||||
        :param load_in_4bit: boolean value, True means load linear's weight to symmetric int 4.
 | 
					        :param load_in_4bit: boolean value, True means load linear's weight to symmetric int 4.
 | 
				
			||||||
                             Default to be False.
 | 
					                             Default to be False.
 | 
				
			||||||
        :param load_in_low_bit: str value, options are sym_int4, asym_int4, sym_int5, asym_int5
 | 
					        :param load_in_low_bit: str value, options are sym_int4, asym_int4, sym_int5, asym_int5
 | 
				
			||||||
                                , sym_int8 or fp16. sym_int4 means symmetric int 4, asym_int4 means
 | 
					                                , sym_int8, nf3, nf4 or fp16. sym_int4 means symmetric int 4,
 | 
				
			||||||
                                asymmetric int 4, etc. Relevant low bit optimizations will
 | 
					                                asym_int4 means asymmetric int 4, nf4 means 4-bit NormalFloat, etc.
 | 
				
			||||||
                                be applied to the model.
 | 
					                                 Relevant low bit optimizations will be applied to the model.
 | 
				
			||||||
        :param optimize_model: boolean value, Whether to further optimize the low_bit llm model.
 | 
					        :param optimize_model: boolean value, Whether to further optimize the low_bit llm model.
 | 
				
			||||||
                               Default to be True.
 | 
					                               Default to be True.
 | 
				
			||||||
        :param modules_to_not_convert: list of str value, modules (nn.Module) that are skipped when
 | 
					        :param modules_to_not_convert: list of str value, modules (nn.Module) that are skipped when
 | 
				
			||||||
| 
						 | 
					@ -106,7 +106,8 @@ class _BaseAutoModelClass:
 | 
				
			||||||
        from .convert import ggml_convert_low_bit
 | 
					        from .convert import ggml_convert_low_bit
 | 
				
			||||||
        invalidInputError(q_k in ggml_tensor_qtype,
 | 
					        invalidInputError(q_k in ggml_tensor_qtype,
 | 
				
			||||||
                          f"Unknown load_in_low_bit value: {q_k}, expected:"
 | 
					                          f"Unknown load_in_low_bit value: {q_k}, expected:"
 | 
				
			||||||
                          f" sym_int4, asym_int4, sym_int5, asym_int5, sym_int8 or fp16.")
 | 
					                          f" sym_int4, asym_int4, sym_int5, asym_int5, sym_int8, nf3, nf4 "
 | 
				
			||||||
 | 
					                          "or fp16.")
 | 
				
			||||||
        qtype = ggml_tensor_qtype[q_k]
 | 
					        qtype = ggml_tensor_qtype[q_k]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # In case it needs a second try,
 | 
					        # In case it needs a second try,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue