Update modeling_lang.py
Browse files- modeling_lang.py +0 -11
modeling_lang.py
CHANGED
|
@@ -19,10 +19,6 @@ class LangDetectorModel(PreTrainedModel):
|
|
| 19 |
|
| 20 |
# Dummy for device checking
|
| 21 |
self.dummy_param = nn.Parameter(torch.zeros(1))
|
| 22 |
-
# Load floret model
|
| 23 |
-
print('Does it arrive here:', self.config.config)
|
| 24 |
-
|
| 25 |
-
# Get filename from config
|
| 26 |
bin_filename = self.config.config.filename
|
| 27 |
|
| 28 |
# Check if the file is already present locally, else download it
|
|
@@ -30,17 +26,10 @@ class LangDetectorModel(PreTrainedModel):
|
|
| 30 |
# print(f"{bin_filename} not found locally, downloading from Hugging Face hub...")
|
| 31 |
bin_filename = hf_hub_download(repo_id=self.config.config._name_or_path,
|
| 32 |
filename=bin_filename)
|
| 33 |
-
# print(f"Downloaded .bin file at: {bin_filename}")
|
| 34 |
-
# else:
|
| 35 |
-
# print(f"{bin_filename} found locally.")
|
| 36 |
|
| 37 |
# Load floret model using the full path
|
| 38 |
self.model_floret = floret.load_model(bin_filename)
|
| 39 |
|
| 40 |
-
|
| 41 |
-
# self.model_floret = floret.load_model(self.config.config.filename)
|
| 42 |
-
|
| 43 |
-
#
|
| 44 |
def forward(self, input_ids, **kwargs):
|
| 45 |
if isinstance(input_ids, str):
|
| 46 |
# If the input is a single string, make it a list for floret
|
|
|
|
| 19 |
|
| 20 |
# Dummy for device checking
|
| 21 |
self.dummy_param = nn.Parameter(torch.zeros(1))
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
bin_filename = self.config.config.filename
|
| 23 |
|
| 24 |
# Check if the file is already present locally, else download it
|
|
|
|
| 26 |
# print(f"{bin_filename} not found locally, downloading from Hugging Face hub...")
|
| 27 |
bin_filename = hf_hub_download(repo_id=self.config.config._name_or_path,
|
| 28 |
filename=bin_filename)
|
|
|
|
|
|
|
|
|
|
| 29 |
|
| 30 |
# Load floret model using the full path
|
| 31 |
self.model_floret = floret.load_model(bin_filename)
|
| 32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
def forward(self, input_ids, **kwargs):
|
| 34 |
if isinstance(input_ids, str):
|
| 35 |
# If the input is a single string, make it a list for floret
|